Jump to content
Sign in to follow this  
Rogueelite

Trying to get autoit to to write variables to cmd prompt

Recommended Posts

Rogueelite

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.

Share this post


Link to post
Share on other sites
ssubirias3

Check the Help file for StdinWrite(), StderrRead(), and StdoutRead() functions.

Share this post


Link to post
Share on other sites
lordofthestrings

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


Share this post


Link to post
Share on other sites
Rogueelite

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

Share this post


Link to post
Share on other sites
Rogueelite

Check the Help file for StdinWrite(), StderrRead(), and StdoutRead() functions.

thanks those worked how i wanted

i cant believe with all the searching i did i wasn't able to find them

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  

×