Jump to content

Command Line


6105
 Share

Recommended Posts

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

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

  • Developers

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

Link to comment
Share on other sites

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.0WIN 8.1 X64 - Other Example Scripts

Link to comment
Share on other sites

  • Developers

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

Link to comment
Share on other sites

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

  • Developers

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

Link to comment
Share on other sites

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]

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