Jump to content

Trying to get autoit to to write variables to cmd prompt


Rogueelite
 Share

Recommended Posts

Hi, im trying to get autoit to write commands to the cmd prompt based on variables that i defined within autoit.

such as,

CODE
$dir = dir

$help = help

$tree = tree

and more complex ones with switches,

$tracert = tracert -d -h 25

or varible that can be used for more than one purpose,

$hostip = 127.0.0.1

$root = C:\

The ultimate purpose is to create a gui-based system for performing lengthy command line procedures.

Example:

CODE
$start = run (@ComSpec & " /c application and switches defined by $var")

im really not sure if its even possible...

the only method i've come up with is having autoit write the lines to a bat. file then executing that bat. file,

but naturally i would like to remove that extra step and make the gui more of an "all in one" utility, because that was the goal from the start.

So a little help for this noob would be greatly appreciated. thx.

Link to comment
Share on other sites

I read the code and immediately catch a basic syntax error..

$start = run (@ComSpec & " /c application and switches defined by $var")

should be :

$start = run (@ComSpec & " /c ....." & $var)

you are mixing variables with strings, @comspec is a macro, "between these quotes is string" and every keyword preceded by a $ sign is a variable.

these need to be added up using the "&" character..

Link to comment
Share on other sites

I read the code and immediately catch a basic syntax error..

$start = run (@ComSpec & " /c application and switches defined by $var")

should be :

$start = run (@ComSpec & " /c ....." & $var)

you are mixing variables with strings, @comspec is a macro, "between these quotes is string" and every keyword preceded by a $ sign is a variable.

these need to be added up using the "&" character..

right, sorry i was just typing that for basic reference

i didn't intend for it to be taken as the literal syntax

of course i would make that actual script with the proper syntax

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...