You are not logged in.
Pages: 1
How do I test for /? or ? or -? within a cmd file?
The IF treats it as a wildcard and does not permit it.
if [%1]==[/?] - will not work.
Any ideas?...
Thanks
Offline
You can use an IF statement like this
if [%1]==[/?] echo Help Requested
but it will only work for the first parameter
e.g. myscript /? but not myscript abc 123 /?
The following will display help for a ? anywhere on the command line
@echo off
set _params=%*
::convert a ? into the text string "found_help"
set _found=%_params:*?=found_help%
:: Now test for that string (in the first 10 chars)
if [%_found:~0,10%]==[found_help] echo Help Requested
Offline
thanks, it helps a lot
Offline
Pages: 1