rename network drives Citrix

I'm having issues renaming drives in citrix. (citrix.bat)
The error is;
system error 85 has occured
The local device name is already in use

I'm using the script:
NET USE E: \\xxxxxx\x1

Windows server 2003
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

If E is already in use by a network drive, try this

If exist e: net use e: /d /y
NET USE E: \\xxxxxx\x1


Experts Exchange Solution brought to you by ConnectWise

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
If might be easier to use letters further up the alphabet and start from Z  Y X etc as windows assigns the drive letters alphabetically and that way you will have less chance of problems with machines with extra drives/partitions etc.
This should help. Add one more line above that.

NET USE E: /delete
NET USE E: \\xxxxxx\x1

Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

kwok76_ukAuthor Commented:
that worked for me, thanks
@Basraj add /y after /d so the script wont ask for confirmation if a file is actually opened.
It's wise to avoid error messages by testing if E exists before removing it.

Another note: E can be a local drive, to test if E is a network drive, the script can be modified like this:

@echo off
(net use |find /i "E:">NUL) && goto AlreadyMapped
(mountvol |find /i "E:">NUL) && goto Local
echo "No E drive found"
Goto MapDrive
If exist E: net use E: /d /y
NET USE E: \\xxxxxx\x1
Goto Finish
echo The E:\ Drive is a local drive (Hard Drive, USB, Card ...)"

Open in new window

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.