Jump to content

Command Line Parameters Problem


DCCD
 Share

Recommended Posts

Hi,

This script work great, but if run "myfile.exe -w" i see the first line "MSGBOX" then "wwwwwwwww"

the "wwwwwwwww" msgbox this what i want

the "DDDDDDDD" msgbox just if i click myfile.exe

Why I should see "DDDDDDDD" msgbox, if i run myfile.exe -w or run myfile.exe -x

MsgBox(4096, "DDDDDDDD", "DDDDDDDD")
If $cmdline[0] > 0 Then
    Switch $cmdline[1]
        Case "-w", "/msg"
            MsgBox(0, "using -w", "wwwwwwwww")
        Case "-x", "/aaa"
            MsgBox(0, "using -x", "xxxxxxxxx")
        Case Else
            ConsoleWrite(" - - - Help - - - " & @crlf)
            ConsoleWrite("  -w : msgbox says Hello!" & @crlf)
            ConsoleWrite("  -x : msgbox says Bye!" & @crlf)
            ConsoleWrite(" - - - - - - - - " & @crlf)
        EndSwitch
    EndIf
Exit
Exit
Link to comment
Share on other sites

Erm you do know that you have to compile your script to take advantages of that right?

Oh and why do you see the DDDDDDDD message box? Because you told it to. Have a careful read of your script.

Here you are.

If $cmdline[0] > 0 Then
    Switch $cmdline[1]
        Case "-w", "/msg" 
            MsgBox(0, "using -w", "wwwwwwwww")
        Case "-x", "/aaa" 
            MsgBox(0, "using -x", "xxxxxxxxx")
        Case Else
            $text = " - - - Help - - - " & @CRLF
            $text &= "  -w : msgbox says Hello!" & @CRLF
            $text &= "  -x : msgbox says Bye!" & @CRLF
            $text &= " - - - - - - - - "
            MsgBox (0, "ERROR", $text)
    EndSwitch
Else
    MsgBox (0, "ERROR", "No Command Line Paramaters!")
EndIf
Edited by BrettF
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...