![]() |
![]() |
|
|
All On Windows XP I am running the following script from a .cmd batch to rename a drive. The problem is I have named the drive before using this, and |
![]() |
|
|
#1 | ||
|
Guest
Posts: n/a
|
All
On Windows XP I am running the following script from a .cmd batch to rename a drive. The problem is I have named the drive before using this, and it seems to be remembering the previous name, and I cannot change it. Why is this please? setlocal set drv=J set drv=%drv:"=% set nn="MY DRIVE" set nn=%nn:"=% set mn="%TEMP%\MapName_%RANDOM%.VBS" if exist %mn% del /q %mn% set er="%TEMP%\MapName_%RANDOM%.TMP" if exist %er% del /q %er% @echo Set oShell = CreateObject("Shell.Application")>%mn% @echo DRIVE = "%drv:~0,1%:\">>%mn% @echo oShell.NameSpace(DRIVE).Self.Name = "%nn%">>%mn% call :quiet>%er% 2>&1 del /q %mn% del /q %er% Cheers Rich |
||
|
|
|
#2 | ||
|
Guest
Posts: n/a
|
"Richhall" <rje.hall@yahoo.co.uk> wrote in message news:6e1b1449-692a-435e-ba45-764678aedd21@d21g2000prf.googlegroups.com... > All > > On Windows XP I am running the following script from a .cmd batch to > rename a drive. The problem is I have named the drive before using > this, and it seems to be remembering the previous name, and I cannot > change it. Why is this please? > > setlocal > set drv=J > set drv=%drv:"=% > set nn="MY DRIVE" > set nn=%nn:"=% > set mn="%TEMP%\MapName_%RANDOM%.VBS" > if exist %mn% del /q %mn% > set er="%TEMP%\MapName_%RANDOM%.TMP" > if exist %er% del /q %er% > @echo Set oShell = CreateObject("Shell.Application")>%mn% > @echo DRIVE = "%drv:~0,1%:\">>%mn% > @echo oShell.NameSpace(DRIVE).Self.Name = "%nn%">>%mn% > call :quiet>%er% 2>&1 > del /q %mn% > del /q %er% > > Cheers > > Rich Your code looks like an elaborate hoax. It its current form it won't do anything useful. |
||
|
| Sponsored Links |
|
|
#3 | ||
|
Guest
Posts: n/a
|
This might be why it doesn't work - i copied it from an old file i
thought worked. Can you tell me how from a batch I can rename what appears in explorer to a newly mapped drive please? i.e. ive used net use j: etc to create a new network mapped drive, but wish to display what is displayed in explorer. Cheers Richc |
||
|
|
|
#4 | ||
|
Guest
Posts: n/a
|
Your phrasing is difficult to understand. IF you create a mapping of "J"
it will be "J", just create the correct desired mapping in the first place. Simply clear all mapping and map drives as desired. NET USE * /D NET USE J: /computername/sharename Richhall wrote: > This might be why it doesn't work - i copied it from an old file i > thought worked. Can you tell me how from a batch I can rename what > appears in explorer to a newly mapped drive please? > > i.e. > > ive used > > net use j: etc to create a new network mapped drive, but wish to > display what is displayed in explorer. > > Cheers > > Richc |
||
|
|
|
#5 | ||
|
Guest
Posts: n/a
|
Apologies
I'll try as suggested, what I mean is say I may a drive net use j: password logon etc then in explorer it appears on the left as: (J) $E on XXX.XX.XX.XX (Windows 2003 server) I want it to simply say (J) E on Rich Server 1 Cheers Rich |
||
|
|
|
#6 | ||
|
Guest
Posts: n/a
|
"Richhall" <rje.hall@yahoo.co.uk> wrote in message news:42f1648a-7052-4501-955a-e89496031999@m34g2000hsb.googlegroups.com... > Apologies > > I'll try as suggested, what I mean is say I may a drive > > net use j: password logon etc > > then in explorer it appears on the left as: > > (J) $E on XXX.XX.XX.XX (Windows 2003 server) > > I want it to simply say > > (J) E on Rich Server 1 > > Cheers > > Rich AFAIK, the description field is fixed. |
||
|
|
|
#7 | ||
|
Guest
Posts: n/a
|
R-click the drive letter in My Computer and pick "Rename". Call it
whatever you want. Richhall wrote: > Apologies > > I'll try as suggested, what I mean is say I may a drive > > net use j: password logon etc > > then in explorer it appears on the left as: > > (J) $E on XXX.XX.XX.XX (Windows 2003 server) > > I want it to simply say > > (J) E on Rich Server 1 > > Cheers > > Rich |
||
|
|
|
#8 | ||
|
Guest
Posts: n/a
|
Pegasus (MVP) wrote: > "Richhall" <rje.hall@yahoo.co.uk> wrote in message > news:42f1648a-7052-4501-955a-e89496031999@m34g2000hsb.googlegroups.com... > >>Apologies >> >>I'll try as suggested, what I mean is say I may a drive >> >>net use j: password logon etc >> >>then in explorer it appears on the left as: >> >>(J) $E on XXX.XX.XX.XX (Windows 2003 server) >> >>I want it to simply say >> >>(J) E on Rich Server 1 >> >>Cheers >> >>Rich > > > AFAIK, the description field is fixed. > > Nah, just use "rename" in My Computer. |
||
|
|
|
#9 | ||
|
Guest
Posts: n/a
|
"Bob I" <birelan@yahoo.com> wrote in message news:eQ000HEZIHA.984@TK2MSFTNGP06.phx.gbl... > R-click the drive letter in My Computer and pick "Rename". Call it > whatever you want. > So it does! Applying this newly learnt piece of info, I knocked together this batch file which makes sense AND works. You need to change lines 2 and 3 to suit your requirements. @echo off echo >"%temp%\ren.vbs" drive = "Q:" echo >>"%temp%\ren.vbs" NewName = "Shared Drive 2" echo >>"%temp%\ren.vbs" Set oShell = CreateObject("Shell.Application") echo >>"%temp%\ren.vbs" oShell.NameSpace("Q:").Self.Name = NewName cscript //nologo "%temp%\ren.vbs" |
||
|
|
|
#10 | ||
|
Guest
Posts: n/a
|
Oops - slight correction. The script should look like this:
@echo off echo >"%temp%\ren.vbs" Drive = "Q:" echo >>"%temp%\ren.vbs" NewName = "Shared Drive 2" echo >>"%temp%\ren.vbs" Set oShell = CreateObject("Shell.Application") echo >>"%temp%\ren.vbs" oShell.NameSpace(Drive).Self.Name = NewName cscript //nologo "%temp%\ren.vbs" |
||
|
![]() |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Local Resources - mapped client's drive has incorrect computer nam | DLecool | Windows NT Server | 19 | 02-05-2008 04:52 PM |
| Group rename problem | Einari | Windows 2003 Server | 3 | 01-10-2008 09:00 AM |
| Batch file to rename with time and date | alexanderd79@googlemail.com | Windows XP | 1 | 11-23-2007 07:57 AM |
| Error in App log regarding mapped drive | jkf1024 | Windows NT Server | 2 | 11-14-2007 02:10 AM |
| Batch Rename | Eric | Windows XP | 10 | 10-04-2007 12:27 AM |