1.

Solve : dashes in batch file?

Answer»

Hello, can anyone explain me what these dashes means and do in this line from batch file?

if -%1 == - GOTO error1
:error1
ECHO please write file name

When I write only batch file name in prompt line (WINDOWS Vista) without any other file and run it, I GET the message 'please write file name'.
I would like to know how these dashes work and where can I use it.The dash is so you can test for a blank parameter. You COULD use any character. Often PEOPLE use quotes before and after, or whatever.

if [%1==[ echo parameter is blank
if "%1"=="" echo parameter is blank
if $%1$==$$ echo paramter is blank
if cat%1==cat echo parameter is blank



Thank you for timeliness. Really helped me ))



Discussion

No Comment Found