Basic batch file review help.

November 22, 2011 at 23:57:21
Specs: Windows XP Sp 3
Hey all, i'm having trouble running the following batch file that's part of the review topic for an exam I have. I don't think the script is written properly, and I keep getting a command syntax error. I've narrowed it down to a problem with the 'for' or 'if' switches, but I'm stuck when it comes to how to fix it.

@echo off
set val=hi
for %%a in (%val%) do echo %%a
if "%val%"=="hihihihihihihihihihihihihihihihihihihihi"
goto sub2
set val=%val%hi
goto sub1
echo ]
echo ]
echo --------------------------
echo \ o o o o /
echo \______________________/

I believe the end result should be a boat with 'hi' as the flag banner streaming across.

Thank you for your time.

See More: Basic batch file review help.

Report •

November 23, 2011 at 09:11:02
We don't usually solve study projects, this would be unfair to you and your tutor. In this instance I will only advise you to study the format/syntax of the IF command. At the command prompt enter IF /? to display information.

Good luck.

Please come back & tell us if your problem is resolved.

Report •
Related Solutions

Ask Question