Link to home
Create AccountLog in
Avatar of saarmstrong

asked on

I am getting "CMD.EXE was started with the above path as the current directory...

Hi All,

I am trying to implement a script which simply copies from a file from a network location to user's computers. the script is simply like this:

@echo off
copy \\server1\share1\file c:\users\user1\desktop\

but when running it the script runs with the following issue:
 "CMD.EXE was started with the above path as the current directory. UNC paths are not supported. Defaulting to windows directory"

I have windows server 2003.

Please advise,

Thank you
Avatar of Don Thomson
Don Thomson
Flag of Canada image

try using the following"

@Echo off
net use z: \\server1\share1
copy z:file c:\users1\desktop
net use z: /delete
Avatar of saarmstrong


thank you,
what if the drive is already in use?
Try using robocopy scripts rather than copy in cmd.

script is:

robocopy "SOURCE PATH" "DESTINATION PATH" /copyall /mir
Use another drive letter
The copy with UNC paths works fine. The message you get only says that the current working directory for the script is not settable, because you are calling the batch from a UNC path. As long as you do not rely on the current directory, i.e. always use absolute paths instead of relative ones, there is no issue (with exception of that distracting message).
Avatar of Steve Knight
Steve Knight
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
Create an account to see this answer
Signing up is free. No credit card required.
Create Account
And BTW if you are not aware the current user desktop directory should normally be:

"%userprofile%\desktop"  so you an use that as the destination in your copy if wanted.

Thanks, hope it helped?

Why that message is print out, and whether it matters, was mentioned by me first. Steve posted only seconds after me, and that is considered to be "at the same time". The added info was informative, but not relevant for the question, so I cannot see why Steve got all the points.
If Experts post similar contents within a few minutes, it is common to accept all such posts.

Could you please explain why http:#a39194485 is "the answer" here?