Welcome!

By registering with us, you'll be able to discuss, share and private message with other members of our community.

SignUp Now!

How to? What does ~ do?

samintz

Scott Mintz
May
1,587
27
I came across a CMD batch file with this syntax:
Code:
if "%~1" == "/?" (
    echo usage: ...
    goto :eof
)

What does %~1 mean as opposed to just %1 ? I tried to test it and got the same results both ways.
 
I found where this is documented in CMD. If you do:
Code:
CMD /c CALL /?
It will show you the substitution of batch parameters syntax.

For those interested:
Code:
%~1         - expands %1 removing any surrounding quotes (")
 

Similar threads

Back
Top