MS OS - Microsoft Forum to Usenet Gateway Header Right
Navbar Left Navbar Right

MS OS - Microsoft Forum to Usenet Gateway » Microsoft Operating System Usenet Gateway » Windows XP » 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



Reply
Old 01-31-2008, 06:02 AM   #1
Richhall
Guest
 
Posts: n/a
Default 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
 
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 01-31-2008, 07:24 AM   #2
Pegasus \(MVP\)
Guest
 
Posts: n/a
Default Re: Apologies if incorrect group - Mapped drive rename from batch error


"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.


 
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Sponsored Links
Old 01-31-2008, 10:04 AM   #3
Richhall
Guest
 
Posts: n/a
Default Re: Apologies if incorrect group - Mapped drive rename from batcherror

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
 
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 01-31-2008, 10:24 AM   #4
Bob I
Guest
 
Posts: n/a
Default Re: Apologies if incorrect group - Mapped drive rename from batcherror

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


 
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 01-31-2008, 01:27 PM   #5
Richhall
Guest
 
Posts: n/a
Default Re: Apologies if incorrect group - Mapped drive rename from batcherror

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
 
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 01-31-2008, 01:55 PM   #6
Pegasus \(MVP\)
Guest
 
Posts: n/a
Default Re: Apologies if incorrect group - Mapped drive rename from batch error


"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.


 
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 01-31-2008, 02:46 PM   #7
Bob I
Guest
 
Posts: n/a
Default Re: Apologies if incorrect group - Mapped drive rename from batcherror

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


 
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 01-31-2008, 02:47 PM   #8
Bob I
Guest
 
Posts: n/a
Default Re: Apologies if incorrect group - Mapped drive rename from batcherror



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.

 
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 01-31-2008, 03:28 PM   #9
Pegasus \(MVP\)
Guest
 
Posts: n/a
Default Re: Apologies if incorrect group - Mapped drive rename from batch error


"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"


 
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 01-31-2008, 03:38 PM   #10
Pegasus \(MVP\)
Guest
 
Posts: n/a
Default Re: Apologies if incorrect group - Mapped drive rename from batch error

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"



 
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off

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


All times are GMT -5. The time now is 07:27 AM.


Powered by vBulletin Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0
Skin designed by CompletevB
Copyright © 2005-2008 Robert Schwarz, Sr. - All rights reserved - MS OS is an independent web site and is not affiliated with Microsoft Corporation.