We have a batch file that takes parameters.
We then read the value of the parameter using %1 for the first parameter.
Question is: How can we check that %1 has a value?
We have a batch file that takes parameters.
We then read the value of the parameter using %1 for the first parameter.
Question is: How can we check that %1 has a value?
According to http://www.robvanderwoude.com/parameters.php you can check them with an if:
or
or
You can branch on the value of %1. For example, one way to do this is
So here is my solution to this issue. I have used this style to use "Named Parameters" insted of the traditional positional values. That way, validation can be done on default and used parms.
Parmameter values could be listed in a file, so that you don't have to change the batch file, just to add a new value. and more text could be added to explain values, etc.
you can try this
Set test=%1
if %test%.==. (echo test not set)