Does any of the path include long file names (including spaces)? You may need to include quotes surrounding the path.
Main Topics
Browse All TopicsHi
I want to run a .bat file from my USB drive that copies files or a folder from the AppData folder from the current user with the same destination as the .bat file is executed from.
Example:
XCOPY C:\Users\%USERNAME%\AppDat
I have also tried some different tags like /H but I can't get it to work. I have successfully copied files from different locations, like C:\Users\%USERNAME%\Deskto
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
I managed to solve it!
I launched the command prompt and manually navigated myself to the USB drive:
cd I:
Then I ran the XCOPY command and this happened:
File creation error - The parameter is incorrect.
Unable to create directory - I:\
0 File(s) copied
I solved this by launching the .bat file from a directory on the I: drive, like I:\example.
I didn't have to use the /H tag because the files I wanted to copy were not hidden. AppData is a hidden folder by default, but it doesn't matter if it's just a part of the path it seems.
I had to use the quote marks (" ") around the source path because it had spaces.
To clarify, it should look like this:
XCOPY "C:\Users\%USERNAME%\AppDa
This could not be run from the root of the USB drive. Put the .bat file in a folder.
Thanks a lot PriceD and MASQUERAID for early replies and good suggestions.
Business Accounts
Answer for Membership
by: PriceDPosted on 2009-08-15 at 10:22:38ID: 25106142
It may be due to files being used in the directory. Are you logged in when you are trying to copy the folder. Log in as a differnt user and then run the file from that user account, assume the that user has full access to the profile in question.
Another way to see if the problem is file being in use. Try to just copy the folder manually and see if it stop due to file being in use.