0

I have a sample batch script:

@echo off

:installed
    echo "checking %1"
    goto :eof

call:installed "aaa"

And when I execute this script, I get the "checking " output, as if there were no arguments passed.

I'm on Windows 8.1

0

2 Answers 2

2

You just need to rearrange your program a bit to manipulate the order of execution.

@echo off
call: installed "aaa"
goto :eof

:installed
    echo "checking %~1"
    goto :eof
Sign up to request clarification or add additional context in comments.

Comments

2

parse your file manually:

@echo off is executed.

:installed the label is ignored

echo "checking %1" is executed with empty %1

goto :eof the batchfile terminates.

The rest is never executed.

Just change the order of execution:

@echo off
call:installed "aaa" 
goto :eof

:installed
    echo "checking %1"
    goto :eof

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.