I am only very new to batch file programming and I have tried to find the solution online, but failed. My batch file calls a c program passing it's own command line arguments to the program then does subsequent steps which depend on the value of the fourth argument (which is an integer). I would like to do an extra step in my batch file if %4 is equal to 3. I have placed some echo test statements. But only the "testno" gets printed even if I enter 3 as my fourth argument.
Batch file name: p2debug1234.bat
Batch file code:
@echo off
@setlocal
p2task1 %1 %2 %3 %4
start mi_viewer %1
start mi_viewer %2
echo %4
echo 3
If ("%4"== "3") (echo testyes) Else (echo testno)
echo testif
Command prompt snapshot:
H:\ELEC4622\labs\data>p2debug1234 pens_rgb.bmp test.bmp 2 3
3
3
testno
testif
Please help me make a valid comparison.
Best Regards, Julia
Change line:
If ("%4"== "3") (echo testyes) Else (echo testno)
to:
If "%4"=="3" (echo testyes) Else (echo testno)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With