Jump to content

Something Easy to Solve - Send a $var to cmd prompt


Recommended Posts

Hi,

Having trouble sending this variable as text to the command prompt window, thanks for the help

here is the code...

#include "ControlSendPlus.au3"

$var1 = InputBox("Machine ID", "Enter Machine ID ( EG: Computer Number 01 to 32")

Run (@COMSPEC)

Sleep (500)

ControlSendPlus ("C:\WINDOWS\system32\cmd.exe", "", "", "mkdir c+;\PrintJob{ENTER}", 0)

Sleep(1000)

ControlSendPlus ("C:\WINDOWS\system32\cmd.exe", "", "", "net use & $var1 &=c+;\Printjob{ENTER}", 0)

No problems sending the text but just problems with varaible just not being replaced with the sharename.

Thanks

Mike

Link to comment
Share on other sites

Hi,

Having trouble sending this variable as text to the command prompt window, thanks for the help

here is the code...

#include "ControlSendPlus.au3"

$var1 = InputBox("Machine ID", "Enter Machine ID ( EG: Computer Number 01 to 32")

Run (@COMSPEC)

Sleep (500)

ControlSendPlus ("C:\WINDOWS\system32\cmd.exe", "", "", "mkdir c+;\PrintJob{ENTER}", 0)

Sleep(1000)

ControlSendPlus ("C:\WINDOWS\system32\cmd.exe", "", "", "net use & $var1 &=c+;\Printjob{ENTER}", 0)

No problems sending the text but just problems with varaible just not being replaced with the sharename.

Thanks

Mike

Controlsend doesn't work with command prompt.

Try this

Run(@ComSpec & " /c " & 'command', "", @SW_HIDE)
Link to comment
Share on other sites

Controlsend doesn't work with command prompt.

Try this

Run(@ComSpec & " /c " & 'command', "", @SW_HIDE)

Hi,

I am using ControlSendPlus with command prompt, which works great. You will need the include to test. All I need to understand is how inside of a block of text that is needed to be sent do I declare the variable I input by the InputBox?

ControlSendPlus.au3

Link to comment
Share on other sites

Hi,

I am using ControlSendPlus with command prompt, which works great. You will need the include to test. All I need to understand is how inside of a block of text that is needed to be sent do I declare the variable I input by the InputBox?

Just tried to break down the delivery of the $var1 to it own ControlSendPlus line and it works...

Thanks for the reply...Sorry I didn't think of this one sooner....

Mike

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