COPY command does not work if run as administrator

I have a batch file which I use for my backup. It runs with administrative privileges. It works fine, except for the last command:

copy /y "D:\HDDocuments\PWSafe\test.psafe3" n:\

Open in new window

This should copy 1 file to a network drive. However, when it tries to execute this, the batch file returns the error "The system cannot find the path specified". If I copy the command line and paste it into a CMD window it runs fine, except if I run CMD as administrator. Conversely, if I do not run the batch file as administrator, the command also executes fine, but then the rest of the batch file fails as it cannot access all files needed.

All other commands in the batch file use ROBOCOPY, and copy to a USB drive, not to a network drive. The network drive is a flash drive that is plugged into my router (TP-Link Archer D5) so it is always visible to other WiFi devices. The PC is hardwired into the router.

Why is it that the same command works if executed as a normal user, but not as administrator?
LVL 40
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

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.

Pierre BengtssonIT-AdminCommented:
I remember having issues once when pointing to a drive letter, can't remember what I did to solve it, but try to use proper UNC path, such as "\\\mydrive\somefolder"

Experts Exchange Solution brought to you by

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
Don't use n:, but use the UNC path that is behind n:
Hello ThereSystem AdministratorCommented:
Specify the UNC path.
hdhondtAuthor Commented:
Using the UNC path did the trick. Thanks everyone. As Pierre was first he gets the points.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Windows 10

From novice to tech pro — start learning today.