1

My laptop isn’t booting, so I’m running a Windows ISO off a DVD and attempting to backup some files to an external hard drive plugged into the USB via Command Prompt.

With command prompt I can enter folders and copy the individual files within them to my hard drive using the robocopy command. (E.g ‘C:\Users\Downloads robocopy E:).

However I want to copy an entire directory such as ‘C:\Program Files (x86)’ including all of the (unzipped) sub folders etc.

I’ve tried using xcopy like this: ‘C\program files (x86)\ E:\ /s /e /h /i /c /y’ & like this: ‘C:\program files (x86)\ E:\’.

But each time command prompt returns the message ‘Invalid number of parameters’.

Any idea on how I could copy these directories?

All help would be much appreciated! Thank you!

0

Here's the syntax that you need for Robocopy if you want to specify a particular source directory.

You would need to run it multiple times in order to back up multiple source folders:

robocopy /e c:\users\mguillaume\downloads "e:\laptop backup"

/e include subfolders and Empty subfolders

/s include Subfolders (but skip empty subfolders)

  • You don't want to use the /s and /e switches together; they conflict. Pick one! I personally prefer to include empty subfolders, so /e is my go-to. The way I see it, completely preserving your existing folder structure, including empty folders, may help you to organize your data in future.

  • Paths containing one or more spaces must be enclosed within double quotation marks. In your example, I noticed that your paths containing spaces were missing their quotation marks.

  • There's no need to use capital letters. Nothing here is case sensitive anyway. Feel free to use them if you want though.

Alternatively, you could copy the entire C drive and simply exclude any directories and files that you don't want. I like to use Robocopy this way, as you can back up everything you want in one shot!

That would look something like this:

robocopy /e c:\ "e:\laptop backup" /xd c:\windows c:\dell /xf c:\pagefil.sys c:\hiberfil.sys /r:0

/xd eXclude Directories

/xf eXclude Files

/r:0 run with zero Retries. I always use this so Robocopy doesn't get stuck on locked files. You will see if anything was skipped in the summary anyway.

  • If you are also tying to copy USER folder files, you may need to take ownership of the folder. You should run RoboCopy with Run as Administrator. – John Sep 8 at 16:40
  • It's not necessary to do either of those things. 1) Running Command Prompt from bootable Windows 10 media always runs it with elevated privileges. The GUI doesn't even present a non-administrator Command Prompt option. 2) The Administrators group and System both have access to all Windows user profile folders by default and either one of those will grant full access to an elevated Command Prompt session, so there's no need to take ownership either. This is why the OP mentions that he is already able to browse his existing directory structure with no problems. 👍🏼 – Mr Ethernet Sep 8 at 19:10
  • @wrecclesham Thanks for your answer! I was missing the quotation marks when using xcopy. Just to clarify for anyone in future, I didn't actually need to backup because windows saved the entire C:\ drive into a folder called windows.old after re-installing via the ISO. – M. Guillaume Sep 11 at 20:21

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.