Jump to content

Sending Text To Cmd In The Background?

Recommended Posts

Run(@comspec & " /c " & $D2Path, "", @SW_HIDE)

that works, for running a shortcut, and i was hoping to use the same method to open the CMD window, send text to it, and close it..

what needs to be sent is:

netstat -n | find "4000" > CurrentServer.txt

it will let the script know what IPs it is connected to on port 4000, if any..

it works just fine manually, if i run cmd, type it in, hit enter, and close cmd.. but being able to just use the command, especially while cmd is completely hidden would really make this script far more efficient..

unfortunately, i have been unable to just plug that in instead of the /c etc..

any help or ideas would be greatly appreciated



Link to comment
Share on other sites

why not try:

Run(@comspec & ' /c netstat -n > c:\CurrentServer2.txt', ""); this works fine for me

this is about what you said

Run(@comspec & ' /c netstat -n | find "4000' > CurrentServer.txt", "", @SW_HIDE);

I think it might be this though

Run(@comspec & ' /c netstat -n 4000 > CurrentServer.txt', "", @SW_HIDE);

The file didn't write on the ones where I called out an interval, just like when it was in the command line.

edit...Dang I guess I write slow...

Edited by scriptkitty

AutoIt3, the MACGYVER Pocket Knife for computers.

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

  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...