6105 Posted December 21, 2010 Share Posted December 21, 2010 How to send command to cmd? like "ping 8.8.8.8" i have tryed this: Run(@ComSpec & " /k" & "ping 8.8.8.8 -t>" & Random(1,999999) & ".xml") but not all work propriety, somebody know another solution? thanks. [center][font=courier new,courier,monospace]Die die die my darling[/font][/center][center][font=courier new,courier,monospace]Don't utter a single word[/font][/center][center][font=courier new,courier,monospace]Die die die my darling[/font][/center][center][font=courier new,courier,monospace]Just shut your pretty mouth[/font][/center][center][font=courier new,courier,monospace]I'll be seeing you again[/font][/center][center][font=courier new,courier,monospace]I'll be seeing you[/font][/center][center][font=courier new,courier,monospace]In hell[/font][/center] Link to comment Share on other sites More sharing options...
Juvigy Posted December 21, 2010 Share Posted December 21, 2010 Try this: Run(@ComSpec & " /k" & "ping 8.8.8.8 -t> c:\123.txt") As you can see it works. You have forgotten to add c:\ (for example) in the file path. Link to comment Share on other sites More sharing options...
ZacUSNYR Posted December 21, 2010 Share Posted December 21, 2010 What he said. It's executing the command but not generating the file where you think it should be (it is generating wherever the default working dir is). You can set it to your script dir or control the path by using the working dir parameter of run as well Run(@ComSpec & " /k" & "ping 8.8.8.8 -t>" & Random(1,999999) & ".txt", @ScriptDir) You can also pull the Random function out of the run command and assign it to a variable so you can know what file name is being generated. $sFile = Random(1,999999) & ".txt" RunWait(@ComSpec & " /k" & "ping 8.8.8.8 -t>" & $sFile, @ScriptDir) ShellExecute($sFile, "", @ScriptDir, "Edit") Link to comment Share on other sites More sharing options...
Developers Jos Posted December 21, 2010 Developers Share Posted December 21, 2010 Make sure there is a spaces between /K and PING ! Why does everyone like to concatenate literal strings this way in stead of simply using one string? SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
wakillon Posted December 21, 2010 Share Posted December 21, 2010 Run ( @ComSpec & " /k ping 8.8.8.8 >" & Random(1,999999) & ".xml", '', @SW_HIDE ) otherwise you have the AutoIt Ping function... $var = Ping ( '8.8.8.8', 250 ) If $var Then; also possible: If @error = 0 Then ... Msgbox ( 0,"Status","Online, roundtrip was:" & $var ) Else Msgbox ( 0,"Status","An error occured with number: " & @error ) EndIf AutoIt 3.3.14.2 X86 - SciTE 3.6.0 - WIN 8.1 X64 - Other Example Scripts Link to comment Share on other sites More sharing options...
Developers Jos Posted December 21, 2010 Developers Share Posted December 21, 2010 (edited) 1/ I dont see why im hijacking this treah is about using autoit to lauch a command , ping was stated as an example.Because I said so.Your and related posts are removed from the thread and better stop arguing about it in this topic.Jos Edited December 21, 2010 by Jos SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
6105 Posted December 22, 2010 Author Share Posted December 22, 2010 Hi, am about another function if i use Run ( @ComSpec ) that is not flexibility, have the Autoit something more easy? what will give command to RUN? bc, if you'll give command in RUN "ping 8.8.8.8" will do the function, and after will be automatic closed. [center][font=courier new,courier,monospace]Die die die my darling[/font][/center][center][font=courier new,courier,monospace]Don't utter a single word[/font][/center][center][font=courier new,courier,monospace]Die die die my darling[/font][/center][center][font=courier new,courier,monospace]Just shut your pretty mouth[/font][/center][center][font=courier new,courier,monospace]I'll be seeing you again[/font][/center][center][font=courier new,courier,monospace]I'll be seeing you[/font][/center][center][font=courier new,courier,monospace]In hell[/font][/center] Link to comment Share on other sites More sharing options...
Developers Jos Posted December 22, 2010 Developers Share Posted December 22, 2010 Hi, am about another function if i use Run ( @ComSpec ) that is not flexibility,have the Autoit something more easy? what will give command to RUN? bc, if you'll give command in RUN "ping 8.8.8.8" will do the function, and after will be automatic closed.What do you mean? its flexible enough when you understand how things work./k will leave the CMD session open and /c will close it after you are done.... or am I misinterpreting what you wrote? SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
6105 Posted December 22, 2010 Author Share Posted December 22, 2010 thank you [center][font=courier new,courier,monospace]Die die die my darling[/font][/center][center][font=courier new,courier,monospace]Don't utter a single word[/font][/center][center][font=courier new,courier,monospace]Die die die my darling[/font][/center][center][font=courier new,courier,monospace]Just shut your pretty mouth[/font][/center][center][font=courier new,courier,monospace]I'll be seeing you again[/font][/center][center][font=courier new,courier,monospace]I'll be seeing you[/font][/center][center][font=courier new,courier,monospace]In hell[/font][/center] Link to comment Share on other sites More sharing options...
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