JBeardNC Posted August 4, 2010 Posted August 4, 2010 Whats the trick to do something like this in AutoIt without using a batch file? I would like to run a command line and then pause so that I (or another user) can see the result of the previous command and then the "pause" would allow me to press any key to close the window. Right now, if I run a command, the shell window closes before I get a chance to see whether the command was successful or not. For example, if I wanted to run the command "net use Z: \\server\share" and then "pause", is it possible to do that using either ShellExecute or just the simple Run (@ComSpec...)? I know with a batch file, I could do it by doing something like this: *test.bat* net use Z: \\server\share pause exit I am wondering if its possible to do this all in one line though so that I do not have to use a batch file and can use the built in AutoIt Run or ShellExecute functions to accomplish this. Hope I'm explaining myself correctly. Thanks for your feedback.
enaiman Posted August 4, 2010 Posted August 4, 2010 You can ShellExecute the batch file - no dramas there. SNMP_UDF ... for SNMPv1 and v2c so far, GetBulk and a new example script wannabe "Unbeatable" Tic-Tac-Toe Paper-Scissor-Rock ... try to beat it anyway :)
JBeardNC Posted August 4, 2010 Author Posted August 4, 2010 I do not want to use a batch file though. Any way around that?
enaiman Posted August 8, 2010 Posted August 8, 2010 Well, have a play with Run, changing the "/c" with "/k" (hope it's correct) to leave the window open after the command runs. Then wait a few seconds and close the window. Something like this: Opt("WinTitleMatchMode", 2) Run(@ComSpec & " /k " & 'net use Z: \\server\share', "", @SW_SHOW) Sleep(2000) WinClose("cmd.exe") You will need to find a more accurate string in window's title to make sure you won't be closing the wrong window. SNMP_UDF ... for SNMPv1 and v2c so far, GetBulk and a new example script wannabe "Unbeatable" Tic-Tac-Toe Paper-Scissor-Rock ... try to beat it anyway :)
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now