Batch Files

By paulhenrydanna
Feb 26, 2008
  1. 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.

  2. Nodsu

    Nodsu TS Rookie Posts: 9,431

    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
    IF NOT %1 = "3" GOTO :end
  3. Nodsu

    Nodsu TS Rookie Posts: 9,431

    Sorry.. I misunderstood your problem. Anyway, you are supposed to use == in if statements, not =.
Topic Status:
Not open for further replies.

Similar Topics

Add New Comment

TechSpot Members
Login or sign up for free,
it takes about 30 seconds.
You may also...

Get complete access to the TechSpot community. Join thousands of technology enthusiasts that contribute and share knowledge in our forum. Get a private inbox, upload your own photo gallery and more.