I’m using getopt to parse options and arguments.
I wrote a batch file to call a python script so I don’t have to type the same command over and over.
When I printed out the list of arguments, the path was split on spaces and each was parsed separately.
The path is enclosed in double quotes, but I’m not sure what the problem is. Is it the batch file, or is getopt not treating it as one string?
If so, what alternatives can I use to correctly parse the options and arguments (especially paths with spaces)?
EDIT: nvm, found the problem. I was putting double quotes around the loop variable in the batch file (ie: “%%X”). It already had double quotes so when I put my own double quotes the path itself was no longer a single string =(
We’ll need to see code to be sure but make sure you quote the argument everywhere not just on the command line.
Command line…
Bash Script…