General discussion

Locked

batch file "copy" command - to desktop

By Mickey.Williams ·
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?

This conversation is currently closed to new comments.

7 total posts (Page 1 of 1)  
| Thread display: Collapse - | Expand +

All Comments

Collapse -

batch file "copy" command - to desktop

by HuckleberryHound In reply to batch file "copy" command ...

Try using the short name for the folders.
C:\DOCUME~1\ALLUSE~1\DESKTOP

Collapse -

batch file "copy" command - to desktop

by Mickey.Williams In reply to batch file "copy" command ...

Poster rated this answer

Collapse -

batch file "copy" command - to desktop

by 1stladytech In reply to batch file "copy" command ...

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

Collapse -

batch file "copy" command - to desktop

by Mickey.Williams In reply to batch file "copy" command ...

Poster rated this answer

Collapse -

batch file "copy" command - to desktop

by Mike Mullins In reply to batch file "copy" command ...

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

Collapse -

batch file "copy" command - to desktop

by Mickey.Williams In reply to batch file "copy" command ...

Good, tried it and liked it.......

Collapse -

batch file "copy" command - to desktop

by Mickey.Williams In reply to batch file "copy" command ...

This question was closed by the author

Back to Windows Forum
7 total posts (Page 1 of 1)  

Related Discussions

Related Forums