Welcome guest. Before posting on our computer help forum, you must register. Click here it's easy and free.

Author Topic: %1 problem  (Read 5436 times)

0 Members and 1 Guest are viewing this topic.

jerome

  • Guest
%1 problem
« on: November 29, 2006, 07:15:53 AM »
hello,

i m trying to write a little batch file but i have a problem,
i will try to explain it but i m not english so it s gonna be another problem ! ;)
well,

batch name: hello.bat

Quote

echo you have pressed %1


for the moment it's easy,
so hello.bat world will print " you have pressed world"

but i would like a kind of security showing " you have to write something like hello.bat test " if nothing is wrote after the batch name but i dont know how to do that.

i'm looking for something like

Quote

IF %1 == null echo "you have to write something like hello.bat test" else ( echo "you have pressed world %1")


thanks,

regards.


gpl



    Apprentice
  • Thanked: 27
    Re: %1 problem
    « Reply #1 on: November 29, 2006, 07:20:53 AM »
    Try this

    IF "%1"=="" echo "you have to write something like hello.bat test" else ( echo "you have pressed world %1")

    Graham

    jerome

    • Guest
    Re: %1 problem
    « Reply #2 on: November 29, 2006, 07:29:36 AM »
    perfect !!!

    thanks a lot!