AutoHotkey Community

It is currently May 27th, 2012, 4:31 am

All times are UTC [ DST ]




Post new topic Reply to topic  [ 8 posts ] 
Author Message
PostPosted: March 1st, 2010, 4:57 am 
Offline

Joined: June 10th, 2008, 12:56 am
Posts: 10
Location: Telford, UK
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 March 1st, 2010, 2:52 pm, edited 1 time in total.

Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: March 1st, 2010, 8:09 am 
Offline

Joined: June 6th, 2006, 3:19 pm
Posts: 1654
Location: Denmark
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


Report this post
Top
 Profile  
Reply with quote  
 Post subject: Running psexec.exe
PostPosted: March 1st, 2010, 11:03 am 
Offline

Joined: June 10th, 2008, 12:56 am
Posts: 10
Location: Telford, UK
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


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: March 1st, 2010, 11:16 am 
Offline

Joined: May 17th, 2007, 12:07 pm
Posts: 1004
Location: Germany - Deutschland
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


Report this post
Top
 Profile  
Reply with quote  
 Post subject: Running psexec.exe
PostPosted: March 1st, 2010, 12:55 pm 
Offline

Joined: June 10th, 2008, 12:56 am
Posts: 10
Location: Telford, UK
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 :)


Report this post
Top
 Profile  
Reply with quote  
 Post subject: Re: Running psexec.exe
PostPosted: March 1st, 2010, 1:19 pm 
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"...


Report this post
Top
  
Reply with quote  
PostPosted: March 1st, 2010, 2:52 pm 
Offline

Joined: June 10th, 2008, 12:56 am
Posts: 10
Location: Telford, UK
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 :)

Cheers


      Report this post
      Top
       Profile  
      Reply with quote  
      PostPosted: March 1st, 2010, 4:20 pm 
      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...


      Report this post
      Top
        
      Reply with quote  
      Display posts from previous:  Sort by  
      Post new topic Reply to topic  [ 8 posts ] 

      All times are UTC [ DST ]


      Who is online

      Users browsing this forum: Mickers, rbrtryn, Yahoo [Bot] and 66 guests


      You can post new topics in this forum
      You can reply to topics in this forum
      You cannot edit your posts in this forum
      You cannot delete your posts in this forum
      You cannot post attachments in this forum

      Search for:
      Powered by phpBB® Forum Software © phpBB Group