Skip navigation

JSI Tip 8885. How can I make My Computer alter the Share Name on 'Computer Name (Comment Text) (Drive Letter:)' sequence that it shows for mapped drive letters on Windows XP SP2?

I have scripted DrvDspy.bat to alter the Share Name on 'Computer Name (Comment Text) (Drive Letter:)' sequence that My Computer uses to display mapped drive letters in Windows XP Service Pack 2 and greater.

The syntax for using DrvDspy.bat is:

DrvDspy Comment Drive \[LCL|ALL\]

Where:

Comment  A 0 will display Share Name on 'Comment Text (Computer Name) (Drive Letter:)'
         A 1 will display Share Name on 'Computer Name (Comment Text) (Drive Letter:)'

Drive    A 1 causes the (Drive Letter:) to be displayed first for mapped drives.
         A 2 causes the (Drive Letter:) to be hidden.
         A 4 causes the (Drive Letter:) to be displayed first for all drives.
If no third parameter is provided, DrvDspy.bat configures the Comment and Drive settings for the current user.

If LCL is provided, DrvDspy.bat configures the Comment and Drive settings for all users of the local computer.

If ALL is provided, DrvDspy.bat configures the Comment and Drive settings for all users of all Windows XP computers in the current domain.

NOTE: If a user has used Windows Explorer during their current session, a log off and log on, or a restart, is required for these setting to become effective.

NOTE: If the ALL parameter is specified, NETDOM.EXE from the Support Tools, on the CD-ROM, must be installed on the computer that runs DrvDspy.bat.

NOTE: DrvDspy.bat should be run from Windows XP or Windows Server 2003. It can be run from Windows 2000 with the ALL parameter if the Windows 2000 Support Tools are installed.

NOTE: See How can I rename a mapped drive?

DrvDspy.bat contains:

@echo off
setlocal
if \{%2\}

\{\} goto err set cmt=%1 set drv=%2 set all=%3 if "%cmt%" EQU "0" goto cmtok if "%cmt%" NEQ "1" goto err :cmtok if "%drv%" EQU "1" goto drvok if "%drv%" EQU "2" goto drvok if "%drv%" NEQ "4" goto err :drvok if \{%3\}

\{\} goto lclusr if /i "%all%" EQU "ALL" goto allxp if /i "%all%" EQU "LCL" goto lclcmp goto err :lclusr set key1=HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer set key2=HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\Explorer call :update endlocal goto :EOF :lclcmp set key1=HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer set key2=HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\Explorer call :update endlocal goto :EOF :allxp set end=findstr /I /L /V /C:"The command completed successfully." for /f "Skip=1 Tokens=*" %%c in ('netdom query /domain:%userdnsdomain% workstation^|%end%') do ( for /f "Tokens=2*" %%r in ('REG QUERY "\\%%c\HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion" /v CurrentVersion^|find "REG_SZ"') do ( if "%%s" EQU "5.1" call :makekey %%c ) ) endlocal goto :EOF :err @echo Syntax: DrvDspy Comment Drive \[LCL^|ALL\] endlocal goto :EOF :makekey set key1=\\%1\HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer set key2=\\%1\HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\Explorer @echo %1 :update REG ADD %key1% /V ToggleCommentPosition /T REG_DWORD /D %cmt% /F REG ADD %key1% /V ShowDriveLettersFirst /T REG_DWORD /D %drv% /F REG ADD %key2% /V ToggleCommentPosition /T REG_DWORD /D %cmt% /F REG ADD %key2% /V ShowDriveLettersFirst /T REG_DWORD /D %drv% /F @echo.



Hide comments

Comments

  • Allowed HTML tags: <em> <strong> <blockquote> <br> <p>

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.
Publish