Jump to content

Run gives me hard time :)


 Share

Recommended Posts

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

Link to comment
Share on other sites

  • Moderators

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.

Link to comment
Share on other sites

  • Moderators

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.

Link to comment
Share on other sites

  • Moderators

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.

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