Jump to content
Sign in to follow this  
Slartybartfast

Command Line Parameters containing quotes

Recommended Posts

Slartybartfast

I need to pass parameters containing quotes to an AutoIt script e.g. /T"New Title"

$CmdLine[$i] strips the quotes e.g. /TNew Title

Is there a way to avoid this?

Do I have to write my own $CmdLineRaw parser, or is there a template available?

Share this post


Link to post
Share on other sites
MHz

Do I have to write my own $CmdLineRaw parser, or is there a template available?

Just do your own parsing as you will need to sort the $CMDLINE parsed to the script anyway.

Example

If $CMDLINE[0] Then
    For $i = 1 To $CMDLINE[0]
        $parameter = $CMDLINE[$i]
        Select
            Case StringLeft($parameter, 2) = '/T'
                $title = StringTrimLeft($parameter, 2)
                If StringInStr($title, ' ') Then
                    $title = '"' & $title & '"'
                EndIf
            Case ; next condition
                ; ........
        EndSelect
    Next
EndIf

:)

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  

×