Discussion Locked

batch file "copy" command - to desktop

0 helpful
7 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

Windows 2000
I have a copy command in a batch file. I want to copy a file to C:\documents and settings\all users\desktop, from within my batch file. Of course if I just cut and paste in windows it works fine, but the batch file "copy" command comes back with a syntax error. The copy command will not copy to this location from the command line.
Is it a rights issue?

7 replies

by 1stladytech

You have to use the xcopy command to copy long file names. We use a similar bat all the time.
Just replace copy with xcopy (since you didn't include the actual bat file) and it should work.

Vickie

by mike mullins

Don't depend on the short name to work. Use the environmental variable that windows has builtin to take you right to where you want to go.
%ALLUSERSPROFILE% will take you to the root of that profile add \desktop to the end and enclose in quotationsto finish the job.

Your batch file should read
copy some.file "%ALLUSERSPROFILE%\desktop\"

Good Luck,
Mike

This discussion is closed to new replies.