AutoHotkey Homepage AutoHotkey Community
Let's help each other out
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Running psexec.exe [Solved]

 
Reply to topic    AutoHotkey Community Forum Index -> Ask for Help
View previous topic :: View next topic  
Author Message
glynd02



Joined: 09 Jun 2008
Posts: 10
Location: Telford, UK

PostPosted: Mon Mar 01, 2010 3:57 am    Post subject: Running psexec.exe [Solved] Reply with quote

I was wondering if anyone could shed some light on running psexec.exe please?

I have tried all sorts to get the program to run correctly all have not worked i.e.

Code:
varPSExecVariable = "psexec \\computername C:\demo.exe"

#x::Run, C:\RemoteTools\psexec.exe %varPSExecVariable%, C:\RemoteTools\


And

Code:
#x::Run, %comspec% /k psexec.exe %varPSExecVariable%, C:\RemoteTools\


Just cannot seem to get the syntax right! Arghh

Any help would be very gratefully received...

Cheers


Last edited by glynd02 on Mon Mar 01, 2010 1:52 pm; edited 1 time in total
Back to top
View user's profile Send private message
tonne



Joined: 06 Jun 2006
Posts: 1651
Location: Denmark

PostPosted: Mon Mar 01, 2010 7:09 am    Post subject: Reply with quote

Code:
; no psexec in the variable
varPSExecVariable = \\computername C:\demo.exe
; or
; varPSExecVariable := "\\computername C:\demo.exe"

#x::Run, C:\RemoteTools\psexec.exe %varPSExecVariable%, C:\RemoteTools\

_________________
RegEx Powered Dynamic Hotstrings
COM
AutoHotkey 2
Back to top
View user's profile Send private message
glynd02



Joined: 09 Jun 2008
Posts: 10
Location: Telford, UK

PostPosted: Mon Mar 01, 2010 10:03 am    Post subject: Running psexec.exe Reply with quote

Thanks Tonne, that worked a treat once I had removed the quotes around the Var and the "psexec" from the Var...

Is there any way to close the CMD window, while leaving the EXE running please?

Cheers
Back to top
View user's profile Send private message
aaffe



Joined: 17 May 2007
Posts: 1002
Location: Germany - Deutschland

PostPosted: Mon Mar 01, 2010 10:16 am    Post subject: Reply with quote

Yes, try this:
Code:
; no psexec in the variable
varPSExecVariable = \\computername C:\demo.exe
; or
; varPSExecVariable := "\\computername C:\demo.exe"

#x::Run, %ComSpec% /c C:\RemoteTools\psexec.exe %varPSExecVariable%, C:\RemoteTools\,HIDE
Back to top
View user's profile Send private message
glynd02



Joined: 09 Jun 2008
Posts: 10
Location: Telford, UK

PostPosted: Mon Mar 01, 2010 11:55 am    Post subject: Running psexec.exe Reply with quote

Thanks very much Aaffe

That does not display the CMD window and the program launches correctly, however it is still visible as running in the Windows Task Manager.

If I kill the process in the TaskManager the EXE continues to run OK...

Should I try and use the WinKill or WinClose commands?

Cheers and sorry to be a pain Smile
Back to top
View user's profile Send private message
Guest






PostPosted: Mon Mar 01, 2010 12:19 pm    Post subject: Re: Running psexec.exe Reply with quote

Also, try...

Code:
toolspath:="C:\RemoteTools"
PSExec_exe:="psexec"
PSExec_params="-d \\computername C:\demo.exe"
PSExec_cmd:=PSExec_exe " " PSExec_params

#x::Run, %toolspath%\%PSExec_cmd%, %toolspath%

...I like vars!...plus the -d means "detach"...
Back to top
glynd02



Joined: 09 Jun 2008
Posts: 10
Location: Telford, UK

PostPosted: Mon Mar 01, 2010 1:52 pm    Post subject: Running psexec.exe [Solved] Reply with quote

Thanks you very much Guest

That did the trick, marvelous! Just had to:

    1. Remove the speech marks around the PSExec_params variable - for some reason PSExec does not like those at all!
    2. Change the PSExec_exe variable to "psexec.exe"

I like vars as well, because they allow you to quickly change stuff if paths change...

Example:
Code:
toolspath:="C:\RemoteTools"
PSExec_exe:="psexec.exe"
PSExec_params=-d \\computername C:\demo.exe
PSExec_cmd:=PSExec_exe " " PSExec_params

#z::Run, %toolspath%\%PSExec_cmd%, %toolspath%


Many thanks to all that answered - you peeps are a great help for those that are struggling Smile

Cheers
      Back to top
      View user's profile Send private message
      Guest






      PostPosted: Mon Mar 01, 2010 3:20 pm    Post subject: Re: Running psexec.exe [Solved] Reply with quote

      glynd02 wrote:
      Just had to:

      1. Remove the speech marks...

      ...double quotes...

      glynd02 wrote:
      ...around the PSExec_params variable

      ...sorry, on that line I had = instead of :=...it should've been := like the rest of em...

      Code:
      PSExec_params:="-d \\computername C:\demo.exe"

      glynd02 wrote:
      2. Change the PSExec_exe variable to "psexec.exe"

      ...I was not sure .exe would be necessary, guess it is...
      Back to top
      Display posts from previous:   
      Reply to topic    AutoHotkey Community Forum Index -> Ask for Help All times are GMT
      Page 1 of 1

       
      Jump to:  
      You can post new topics in this forum
      You can reply to topics in this forum


      Powered by phpBB © 2001, 2005 phpBB Group