abirvalg Posted November 1, 2007 Share Posted November 1, 2007 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 More sharing options...
Moderators SmOke_N Posted November 1, 2007 Moderators Share Posted November 1, 2007 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. Link to comment Share on other sites More sharing options...
abirvalg Posted November 1, 2007 Author Share Posted November 1, 2007 Did you try RunAs?nopebut it's not a permission issueif i hardcode a computer name in it works great Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted November 1, 2007 Moderators Share Posted November 1, 2007 (edited) nope but it's not a permission issue if i hardcode a computer name in it works greatAre 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 November 1, 2007 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 More sharing options...
abirvalg Posted November 1, 2007 Author Share Posted November 1, 2007 Are there spaces in the $txt var, or the "task to be killed"?nono spaces in both computer and task names Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted November 1, 2007 Moderators Share Posted November 1, 2007 nono spaces in both computer and task namesRead 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 More sharing options...
abirvalg Posted November 1, 2007 Author Share Posted November 1, 2007 Read my edit.that's it!Duh!!!! & $text & - is all i needed to fixThanks a bunch! Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted November 1, 2007 Moderators Share Posted November 1, 2007 that's it!Duh!!!! & $text & - is all i needed to fixThanks a bunch!If you download SciTE full edition editor (most of us here use it):http://www.autoitscript.com/autoit3/downloads.shtmlAnd 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 More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now