5

I know this is a stupid question I've made batch files for years and haven't had this much trouble... I'm trying to make a batch file to copy files into a folder and for the life of me I can't get it to work.

cd C:\Program Files (x86)\Steam\SteamApps\common\Skyrim\Data\
copy FifthGenerationMage.bsa C:\Users\Mark Collins\Desktop\DATA
copy FifthGenerationMage.bsl C:\Users\Mark Collins\Desktop\DATA
copy FifthGenerationMage.ckm C:\Users\Mark Collins\Desktop\DATA
copy FifthGenerationMage.esp C:\Users\Mark Collins\Desktop\DATA
pause

This should work, right? Copy , right? When I do it like this, it says the syntax is incorrect.

When I do this:

copy C:\Program Files (x86)\Steam\SteamApps\common\Skyrim\Data\FifthGenerationMage.bsa C:\Users\Mark Collins\Desktop\DATA
copy C:\Program Files (x86)\Steam\SteamApps\common\Skyrim\Data\FifthGenerationMage.bsl C:\Users\Mark Collins\Desktop\DATA
copy C:\Program Files (x86)\Steam\SteamApps\common\Skyrim\Data\FifthGenerationMage.ckm C:\Users\Mark Collins\Desktop\DATA
copy C:\Program Files (x86)\Steam\SteamApps\common\Skyrim\Data\FifthGenerationMage.esp C:\Users\Mark Collins\Desktop\DATA

It says "The System cannot find the file specified."

Both of those should work. I don't get it.

  • 2
    Where are the quotes since your paths contain spaces....Either that use the short hand for those folders. Both of your commands are incorrect for that reason. – Ramhound Nov 24 '14 at 19:53
  • 1
    There is no DOS in Windows since Windows 2000. Windows XP and later Windows systems have text console, also called Command Line or CMD. – Kamil Nov 24 '14 at 19:54
  • Ramhound of course. That was it. You rock. Kamil, I know, I know... it looks like DOS, so I call it DOS, even though it's not an operating system... While that is a very real distinction, I never understood why it was that important – Mark Collins Nov 24 '14 at 19:56
  • @MarkCollins - Be specific. If you know the difference use the correct term. The details are important. They are also the different between a quality question and something that isn't. – Ramhound Nov 24 '14 at 19:57
  • 1
    It is worth noting that the cd command takes only one parameter (and a possible option), so the whole of the passed string is taken as the parameter (including blanks), which is why the quotes are optional. They would be needed if the directory name has a leading or trailing blank. – AFH Nov 24 '14 at 21:04
10

If your path contains spaces - you have to enclose whole path with ", like this:

copy "C:\Program Files (x86)\...\FifthGenerationMage.bsa" "C:\Users\...\DATA"

I would also suggest to use variable to store target path and simplify script:

set skyrimdata="C:\Program Files (x86)\Steam\SteamApps\common\Skyrim\Data"
set target="C:\Users\Mark Collins\Desktop\DATA"

copy "%skyrimdata%\FifthGenerationMage.bsa" %target%
copy "%skyrimdata%\FifthGenerationMage.bsl" %target%
copy "%skyrimdata%\FifthGenerationMage.ckm" %target%
copy "%skyrimdata%\FifthGenerationMage.esp" %target%

Why it doesnt work?

Look:

|     | 1         | 2    | 3               | 4      |5      |
 copy   C:\Folder   with   spaces\file.txt   E:\Some folder

System reads it as:

1 - parameter 1 (for copy command - source 1)

2 - parameter 2 (for copy command - source 2)

3 - parameter 3 (for copy command - source 3)

4 - parameter 4 (for copy command - source 4)

5 - parameter 5 (for copy command - target)

There are no C:\Folder, with, spaces\file.txt files or directories - and you get error:

The System cannot find the file specified.

  • 1
    Adding some supplement information. This could also happen if one of the following characters are present in the filename < > : " / \ | ? *. In my case, a script was extracting the forward slash instead of the date from the %date% variable and appending it to the filename. I kept getting the system cannot find the path error until I corrected the filename. – Stephen Jacob May 14 at 2:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.