I am trying to run a batch file that's located in:
C:\Test Batch\BatchTest.bat
That will copy a file from another specified location, let's say
C:\Users\UserName\Desktop\Company Downloads\downloadedDoc.doc
I can run the batch file as:
cmd /c start "" "C:\Test Batch\TestBatch.bat"
And the batch actually does run.
But when I try to add an argument for it to copy like this:
cmd /c start "" "C:\Test Batch\TestBatch.bat" "C:\Users\User Name\Desktop\Company Downloads\downloadedDoc.doc"
I get:
'C:\Test' is not recognized a an internal or external command, operable program or batch file.
Ultimately the batch file and file to be copied will be specified by a user and will likely have spaces in the names or path. So a simple answer to use paths without spaces will not suffice.
Try changing the startup directory with the /d argument to start like so:
cmd /c start "" /d"C:\Test Batch\" "TestBatch.bat" "C:\Users\User Name\Desktop\Company Downloads\downloadedDoc.doc"
The start command has some oddities parsing quotes.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With