Batch Files

Status
Not open for further replies.
Posting new Threads / Batch Files

It has been a long time since I used this site. I had a hard time finding where to make a new post, even though I had done it previously.

My situation is that I want to pass a paremeter in my batch file. The file is rather simple.



IF %1 = "3" XCOPY w:/*.* C:\OLDDOCS\ /S/V/Y/D
cd c:\Billing\Progs
vfp9.exe Main.Prg

I only want to execute the "XCOPY" command when the parameter is "3".

What happens is that when the parameter is "3", the "XCOPY" command will execute, but none of the commands that follow it.

If the parameter is not "3", then nothing executes.

If I remove "IF %1 = "3" ", then every thing executes.

Help
 
You managed to post in the wrong forum. I don't see why you wouldn't be able to post in the correct forum..

Anyway, use a goto statement and reverse logic instead. Something like
Code:
IF NOT %1 = "3" GOTO :end
COMMAND1
COMMAND2
COMMAND3
:end
 
Sorry.. I misunderstood your problem. Anyway, you are supposed to use == in if statements, not =.
 
Status
Not open for further replies.
Back