I am attempting to pass command line arguments to a console application(Computer Language Compiler).
My Problem: The argument I am passing contains a hyphen character and it is causing an error "- was unexpected command/character".
This is the command line argument I am using(12d.exe is the application/compiler):
12d.exe "C:/Staff - Name/abc.4dm"
It seems that its looking at the '-' as a command and not part of a directory/string. Maybe I can use a batch file to perform this command line and reformat the directory path? You know how like in HTTP POST I can use urlencode to format post commands, maybe I can encode the command line in a batch file.
You could try adding a ^
to "escape" the hyphen in the batch making batch ignore it.
12d.exe "C:/Staff ^- Name/abc.4dm"
It seems that 12d.exe does not understand some valid filenames, shame on 12d.exe.
There are a couple actions you might do,
try to pass the short filename instead. It may work in some cases where the hyphen -
is off the right of the string. Not in your case, though, as it will probably translate as STAFF-~1
or something similar.
call :invoke12d "Staff - Name\abc.4dm"
goto :eof
:invoke12d
12d %~s1
goto :eof
or create a junction, a symbolic link, to call the directory with another name that does not contain hyphens. See this http://technet.microsoft.com/en-us/sysinternals/bb896768 for more information and to download a simple tool.
junction staffnam "Staff - Name"
12d.exe "staffnam/abc.4dm"
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