Jump to content
Sign in to follow this  
Chetwood

Exit script when no command line parameter is given

Recommended Posts

Chetwood

Apparently I can't see the forest for the trees so maybe someone of you can help me out. I have a little script that among other things opens the cd tray when a drive letter is given as a command-line parameter. "myscript.au3 e" would open drive e. But how do I make the script exit immediately when it is started without any parameter?

If $CmdLine[0] Then 
Exit
Else
do fancy stuff
EndIf
Exit

does still execute "do fancy stuff" instad of stopping immediately. TIA.


MultiMakeMKV: batch processing for MakeMKV (Win)MultiShrink: batch processing for DVD ShrinkOffizieller √úbersetzer von DVD Shrink deutsch

Share this post


Link to post
Share on other sites
funkey

If $CmdLine[0] = 0 Then
 MsgBox(16, "Error", "No commandline parameter given!")
 Exit
EndIf


Programming today is a race between software engineers striving to
build bigger and better idiot-proof programs, and the Universe
trying to produce bigger and better idiots.
So far, the Universe is winning.

Share this post


Link to post
Share on other sites
Chetwood

D'uh. Thanks.


MultiMakeMKV: batch processing for MakeMKV (Win)MultiShrink: batch processing for DVD ShrinkOffizieller √úbersetzer von DVD Shrink deutsch

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×