Jump to content

Recommended Posts

Posted (edited)

Hello,

I've made a GUI that can send multiple commands.
The way I'm doing this at the moment is whit "send" commands.
also first go to the right directory where the "to be used" program sits
And send from there the commandline argument whit parameters.

Here is a example of the way I'm using it now:

Func restart_app($xip)
   Run("C:\WINDOWS\system32\cmd.exe")
   WinWaitActive("C:\WINDOWS\system32\cmd.exe")
   Sleep(50)
   send("cd\" & "{ENTER}")
   Sleep(50)
   send("cd Tools" & "{ENTER}")
   Sleep(50)
   send("pskill \\" & $$xip & " -u username -p pass /accepteula app.exe" & "{ENTER}")
EndFunc

This way is working and I got no problems whit this.
Also I realy think there is a mush better and way to do the same and maybe a little bit less error free :)
(even better if this is hidden for the user :))
On this forum I could not find anything related to this subject (or I was not looking in the right direction) and hope somebody knows a better way :)

Is there a way where u can send the arguments and parameters directly in 1 line to the commandpromt whitout using "send" to commandprompt?

Thanks in advanced

ps: I also tried :

ShellExecute("pskill", "\\" & $xip & " -u username -p pass /accepteula app.exe")

But din't work

Edited by FMS

as finishing touch god created the dutch

Posted

@Skitty

Thanks , this was indeed what i was looking for.
For futher referense :
 

RunWait(@ComSpec & " /k " & "pskill \\" & $xip & " -u username -p pass /accepteula posclient.exe"  , "C:\tools",@SW_HIDE )

/k is for debugging....

as finishing touch god created the dutch

  • 2 weeks later...
Posted

Hi.

PSKILL.EXE does *NOT* need a @comspec shell to execute,

And " /k " instead of " /c " just doesn't exit the comspec shell after the called program terminated.

 

Regards, Rudi.

Earth is flat, pigs can fly, and Nuclear Power is SAFE!

Posted

Good luck:

Func _PsKill($AppName, $IP = "", $Uname = "", $PassWord = "")
    If StringStripWS($AppName, 8) = "" Then Return SetError(1, 0, 0)
    Local $sCommand, $PsKillEXE = @ScriptDir & "\pskill.exe"
    If $IP <> "" Then $sCommand &= " \\" & $IP
    If $Uname <> "" Then $sCommand &= ' -u ' & $Uname & ''
    If $PassWord <> "" Then $sCommand &= ' -p "' & $PassWord & '"'
    $sCommand &= " /accepteula " & $AppName
;~  RunWait('"' & $PsKillEXE & '" ' & $sCommand, @ScriptDir, @SW_HIDE)
    ShellExecute($PsKillEXE, $sCommand, @ScriptDir, "", @SW_HIDE)
EndFunc   ;==>_PsKill

 

Regards,
 

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
×
×
  • Create New...