Jump to content
Sign in to follow this  
abirvalg

Run gives me hard time :)

Recommended Posts

abirvalg

need to kill a predefined task remotely by inputing just a computer name

i can't seem to be able to pass a variable to the Run commmand

gives me Run(^ERROR

what am i doing wrong?

thanks!

Global $text = InputBox("Machine name", "Input Machine Name and click OK")

Run("pskill.exe -t \\" & $text " task_name_to _be_killed")

Share this post


Link to post
Share on other sites
SmOke_N

Did you try RunAs?


Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Share this post


Link to post
Share on other sites
abirvalg

Did you try RunAs?

nope

but it's not a permission issue

if i hardcode a computer name in it works great

Share this post


Link to post
Share on other sites
SmOke_N

nope

but it's not a permission issue

if i hardcode a computer name in it works great

Are there spaces in the $txt var, or the "task to be killed"?

Edit:

I'm assuming the ampersand you are leaving out after $text, is only left out because you hand wrote your example.

You could always try and play it safe:

$sPSKillLocation = "pskill.exe"
$sText = "whatever location"
$sTask = "whatever you're doing"

Run('"' & $sPSKillLocation & '" -t "\\' & $sText & '" "' & $sTask & '"')
Edited by SmOke_N

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Share this post


Link to post
Share on other sites
abirvalg

Are there spaces in the $txt var, or the "task to be killed"?

no

no spaces in both computer and task names

Share this post


Link to post
Share on other sites
SmOke_N

no

no spaces in both computer and task names

Read my edit.

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Share this post


Link to post
Share on other sites
abirvalg

Read my edit.

that's it!

Duh!!!! <_<

& $text & - is all i needed to fix

Thanks a bunch!

Share this post


Link to post
Share on other sites
SmOke_N

that's it!

Duh!!!! <_<

& $text & - is all i needed to fix

Thanks a bunch!

If you download SciTE full edition editor (most of us here use it):

http://www.autoitscript.com/autoit3/downloads.shtml

And run syntax checking from the tools menu, you'll find little mistakes like this easily :) ...


Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Share this post


Link to post
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
Sign in to follow this  

×