Sign in to follow this  
Followers 0
Xenobiologist

commandline parameter pairs

5 posts in this topic

Hi,

anybody an idea of how to get the pairs from $cmdline?

Something like this:

bla.exe -i Input -o Output -s -t

Getting an array back :

[1][0] i

[1][1] Input

[2][0] o

[2][1] Output

[3][0] s

[3][1]

[4][0] t

[4][1]

So long,

Mega


Scripts & functions Organize Includes Let Scite organize the include files

Yahtzee The game "Yahtzee" (Kniffel, DiceLion)

LoginWrapper Secure scripts by adding a query (authentication)

_RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...)

Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc.

MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times

Share this post


Link to post
Share on other sites

CmdLine is a single dim array. Compile this and run with params

If $cmdline[0] > 0 Then
    $i = ""
    $j = 1
    For $j = 1 To $cmdline[0]
        $i &= $j & ": " &$cmdline[$j] & @CRLF
    Next
    MsgBox(0,"", "params = " & $cmdline[0] & @CRLF & $i)
EndIf

Share this post


Link to post
Share on other sites

Use this:

; Example

ShellExecute(@ScriptDir & '\Tool.exe', '"Name=Test,Category=Test,User=Admin"')oÝ÷ ØÆ¢'+ZºÚ"µÍÚ[ÛYH   Ð^K]LÉÝÂY   ÌÍÐÓQSVÌH  ÝÈ[BIÌÍÝHÙ][Y]Ê  ÌÍÐÓQSVÌWJBBWÐ^QÜ^J  ÌÍÝBB[Y[ÈÙ][Y]Ê   ÌÍÜ×ØÛY[JBBQ[H    ÌÍÝØ^VÌWVÌBBIÌÍØ^HHÝ[ÔÜ]
    ÌÍÜ×ØÛY[K ][ÝË  ][ÝÊBBRYPÝ[
    ÌÍØ^K
HHH[BBBTQ[H ÌÍÝØ^VÕPÝ[
    ÌÍØ^JWVÌBBBBQÜ ÌÍÚHHHÈPÝ[
    ÌÍØ^JHHBBBBBBIÌÍÜHÝ[ÔÜ]
    ÌÍØ^VÉÌÍÚWK  ][ÝÏI][ÝÊBBBBBBIÌÍÝØ^VÉÌÍÚWVÌHH    ÌÍÜÌWBBBIÌÍÝØ^VÉÌÍÚWVÌWHH  ÌÍÜÌBBBBBS^BBBIÌÍØ^HH    ÌÍÝØ^BBBQ[YBT]  ÌÍØ^BB[[ÈÏOIÝÑÙ][Y]

My UDFs:- _RegEnumKey

Share this post


Link to post
Share on other sites

Try it:

#include <Array.au3>

If $CmdLine[0] <> 0 Then
    Dim $Array[1][2]
    For $x = 1 To $CmdLine[0]
        If StringLeft($CmdLine[$x], 1) = '-' Then
            ReDim $Array[UBound($Array) + 1][2]
            $Array[UBound($Array) - 1][0] = StringTrimLeft($CmdLine[$x], 1)
            ContinueLoop
        EndIf
        $Array[UBound($Array) - 1][1] = $CmdLine[$x]
    Next
    $Array[0][0] = UBound($Array) - 1
EndIf

_ArrayDisplay($Array)


AutoIt Scripts:NetPrinter - Network Printer UtilityRobocopyGUI - GUI interface for M$ robocopy command line

Share this post


Link to post
Share on other sites

Hi,

thx to for your suggestions/solutions. I'll check them.

So long,

Mega


Scripts & functions Organize Includes Let Scite organize the include files

Yahtzee The game "Yahtzee" (Kniffel, DiceLion)

LoginWrapper Secure scripts by adding a query (authentication)

_RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...)

Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc.

MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times

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  
Followers 0