Jump to content

Recommended Posts

Posted

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]

Posted

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")
Posted

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.18.0 X86 - SciTE 5.5.7WIN 11 24H2 X64 - Other Examples Scripts

  • Developers
Posted (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 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.
  :)

Posted

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]

  • Developers
Posted

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? :x

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

Posted

thank you :x

[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]

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
×
×
  • Create New...