Invalid drive specification using XCOPY
Try mounting your remote drive locally first: Then try copying the files from X: instead: To unmount:
Try mounting your remote drive locally first: Then try copying the files from X: instead: To unmount:
This will set countfiles to 0. I think you want to decrease it by 1, so use this instead: I’m not sure if the for loop will work, better try something like this:
Look into xcopy, which will recursively copy files and subdirectories. There are examples, 2/3 down the page. Of particular use is: To copy all the files and subdirectories (including any empty subdirectories) from drive A to drive B, type: xcopy a: b: /s /e
XCOPY is an old command harking back to the days of DOS. It looks like the /EXCLUDE option was never updated to support long file names. Ugh 🙁 If you remove the quotes, then the text after the space is interpreted as an additional parameter, and you get the “Invalid number of parameters” error. If … Read more
From within your batch file: %cd% refers to the current working directory (variable) %~dp0 refers to the full path to the batch file’s directory (static) %~dpnx0 and %~f0 both refer to the full path to the batch directory and file name (static). See also: What does %~dp0 mean, and how does it work?
You need to separate the arguments from the file path: Another option that may ease the syntax using the File parameter and positional parameters:
timeout 5 to delay timeout 5 >nul to delay without asking you to press any key to cancel
The space before the = is interpreted as part of the name, and the space after it (as well as the quotation marks) are interpreted as part of the value. So the variable you’ve created can be referenced with %location %. If that’s not what you want, remove the extra space(s) in the definition.
You have it almost done. The logic is correct, just some little changes. This code checks for the existence of the folder (see the ending backslash, just to differentiate a folder from a file with the same name). If it does not exist then it is created and creation status is checked. If a file … Read more