Jdr Posted July 5, 2016 Posted July 5, 2016 I'm using this code: #include <Constants.au3> Global $DOS, $Message = '' ;; added "= ''" for show only. $DOS = Run(@ComSpec & " /c tasklist /S server1 /U server1\admin /P password /FI " "USERNAME" & "eq" & @UserName /FI ""IMAGENAME eq notep*""", "", @SW_HIDE, $STDERR_CHILD + $STDOUT_CHILD) ProcessWaitClose($DOS) $Message = StdoutRead($DOS) MsgBox(0, "Stdout Read:", $Message) But I can't get the syntax right. The tasklist command from the commandline goes like this and works: tasklist /S server1 /U server1\admin /P password /FI "USERNAME eq user1" /FI "IMAGENAME eq notep*". So everything behind the FI parameter needs quotes. I'm using the @username macro to get the logged on user. But I just can't get the syntax right.
Developers Jos Posted July 5, 2016 Developers Posted July 5, 2016 (edited) Something like this working? $DOS = Run(@ComSpec & ' /c tasklist /S server1 /U server1\admin /P password /FI "USERNAME eq ' & @UserName & '" /FI "IMAGENAME eq notep*"', "", @SW_HIDE, $STDERR_CHILD + $STDOUT_CHILD) Jos Edited July 5, 2016 by Jos SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past.
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