einer fertig generierten .exe parameter mitgeben?

  • Hallo zusammen,
    habe mal ne Frage:
    Kann ich einer fertig generierten exe einen Parameter mitgeben?

    Also z.B.
    D:\InstallTool.exe /install --> ruft die functuin install() auf
    D:\InstallTool.exe /uninstall --> ruft die functuin uninstall() auf

    Das mit der function war nur mal ne überlegung von mir vielleicht wird das ja anderst gehandhabt, bzw. es geht vielleicht gar nicht aber ihr wisst da sicher weiter :rolleyes:

    Danke schonmal im Vorraus
    c ya
    Paddy

  • hier aus der hilfe:
    Command Line Parameters
    The special array $CmdLine is initialized with the command line parameters passed in to your AutoIt script. Note the scriptname is not classed as a parameter; get this information with @ScriptName instead. A parameter that contains spaces must be surrounded by "double quotes". Compiled scripts accept command line parameters in the same way.

    $CmdLine[0] is number of parameters
    $CmdLine[1] is param 1 (after the script name)
    $CmdLine[2] is param 2 etc
    ...
    $CmdLine[$CmdLine[0]] is one way to get the last parameter...


    So if your script is run like this:

    AutoIt3.exe myscript.au3 param1 "this is another param"

    $CmdLine[0] equals... 2

    $CmdLine[1] equals... param1

    $CmdLine[2] equals... this is another param

    @ScriptName equals... myscript.au3


    In addition to $CmdLine there is a variable called $CmdLineRaw that contains the entire command line unsplit, so for the above example:

    $CmdLineRaw equals... myscript.au3 param1 "this is another param"


    If the script was compiled it would have been run like this:

    myscript.exe param1 "this is another param"

    $CmdLineRaw equals... param1 "this is another param"

    Note that $CmdLineRaw just return the parameters.


    Note : only 63 parameters can be return by $CmdLine[...], but $CmdLineRaw will always returns the entire command line.


    AutoIt specific command Line Switches
    Form1: AutoIt3.exe [/ErrorStdOut] [/AutoIt3ExecuteScript] file [params ...]
    Execute an AutoIt3 Script File


    /ErrorStdOut Allows to redirect fatal error to StdOut which can be captured by an application as Scite editor. This switch can be used with a compiled script.

    To execute a standard AutoIt Script File 'myscript.au3', use the command:
    'AutoIt3.exe myscript.au3'


    Form2: Compiled.exe [/ErrorStdOut] [params ...]
    Execute an compiled AutoIt3 Script File produced with Aut2Exe.

    Form3: Compiled.exe [/ErrorStdOut] [/AutoIt3ExecuteScript file] [params ...]
    Execute another script file from a compiled AutoIt3 Script File. Then you don't need to fileinstall another copy of AutoIT3.exe in your compiled file.


    Form4: AutoIt3.exe [/ErrorStdOut] /AutoIt3ExecuteLine "command line"
    Execute one line of code.

    To execute a single line of code, use the command:
    Run(@AutoItExe & ' /AutoIt3ExecuteLine "MsgBox(0, ''Hello World!'', ''Hi!'')"')

    The tray icon will not be displayed when using /AutoIt3ExecuteLine

    NOTE: Correct usage of single- and double- quotation marks is important, even double single.

    Edit: weitere infos findest du hier im forum, wenn du mal nach "cmdline" suchst.

    gruss exberliner

    Einmal editiert, zuletzt von ExBerliner (14. November 2006 um 12:11)

    • Offizieller Beitrag

    Hi,

    das funktioniert auch wenn du eine au3 Datei hast, nicht nur bei der exe. Wichtig ist, dass du erst abprüfst.

    If $cmdline[0] > 0 Then

    If $cmdline[1] = "Hugo" Then MsgBox(0,"", "juhu")

    ...

    Wenn du gleich auf den ersten prüfst, kann es zum Abbruch kommen!

    So long,

    Mega

    Edit: kleines Bsp:

    [autoit]

    If $CmdLine[0] > 0 And $CmdLine[1] <> "" Then
    MsgBox(0, "", "mit Parameter")
    Else
    MsgBox(0,"", "ohne Parameter")
    EndIf

    [/autoit]
  • Nabend ihr Lieben.

    Ich habe gerade das INetSend hier und wollte bevor ich gleich essen gehe (mit Freundin), hier die datei mit Parametern aufrufen.

    Blicke nicht durch die Befehlt cmdLine durch.

    $as_Body[0] = Parameter 1 statt: "Moinsens"
    $as_Body[1] = Parameter 2 statt: "Das ist eine Test-Email"

    aufrufen will ich: inetsend.exe "moinsens" "Das ist eine test-Mail".

    Liebe Grüße noch schnell sendet, bevor ich mit meiner besten Freundin gleich zu essen gehe.

    Lina

    Lieben Gruß,
    Alina

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

    Geheime Information: ;)
    OuBVU5ebLhHu5QvlnAyQB4A7SzBrvWulwL7RLl2BdH5tI6sIYspeMKeXMSXl