Apologies if incorrect group - Mapped drive rename from batch error



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
.



Relevant Pages

  • RE: Deleting FIles
    ... parameter on the DEL command - this should delete a hidden file ... When the script runs, who is it running as (the current user, ... The computername part of the code is ... I think that it actually runs as the SYSTEM account, ...
    (microsoft.public.windows.server.scripting)
  • Re: Apologies if incorrect group - Mapped drive rename from batch error
    ... On Windows XP I am running the following script from a .cmd batch to ... rename a drive. ... if exist %mn% del /q %mn% ...
    (microsoft.public.windowsxp.general)
  • gzip archives coming up invalid!
    ... turns out they are all corrupt! ... This is the script I am using, maybe there is a problem with it?? ... del $OLDDATE.var.tar.gz ...
    (RedHat)
  • Re: How do I clear out files within a directory? Help with script automation...
    ... The script that works!!! ... del *.* /Q ... > a batch file to be run at logon, that will clear out the entire contents ... > Best Regards, ...
    (microsoft.public.windows.file_system)
  • Re: DEL command help
    ... filenames must be less than ... ... 'del' command with 'echo del'. ... I couldn't get the command working. ... >> the script becomes too fragmented and awkward to reconstruct). ...
    (microsoft.public.win2000.cmdprompt.admin)