Jump to content
Sign in to follow this  
shahino007

Psexec and xcopy

Recommended Posts

shahino007

Hey,

I've looked already in all previous posts in this matter and tried all offers...but nothing:

I'm tring to copy exe file from local computer to remote computer using psexec command:

Run('psexec remotecomp xcopy "C:file.exe" "C:"')

but I keep getting the message that file wasn't found.

During my later tries I created the exe file in the remote computer and activated again the RUN command from the local computer (just to test what happens). Then I realized that all this time the xcopy searched the source file in the remote computer and not in the local one (got error message that says that the file cannot be copied on itself). When I changed the directories of source and destination to be different, the xcopy was OK: Run('psexec remotecomp xcopy "C:file.exe" "C:temp"'). Again - This time it was xopy from one directory in the remote to another in the same remote.

How do I tell the xcopy to take the file from the local computer and copy it to the remote...?

Share this post


Link to post
Share on other sites
orbs

before you go any further - you do know that you can copy files without PsExec, right?

edit: and welcome to the AutoIt forum  :)

Edited by orbs

Share this post


Link to post
Share on other sites
shahino007

Thanks,

I know that in order to send commands to remote computer I need the psexec.

Can you enlighten me please...:)

Share this post


Link to post
Share on other sites
orbs

PsExec is not used to send command to remote computer. PsExec is used to make the remote computer execute commands. this is not the same.

file copy command can be executed on any machine. if you just need to copy the file, then just copy it:

xcopy source_hostsource_sharesubfolderfile.ext target_hosttarget_sharesubfolder

if you specify the paths correctly, and you have sufficient permissions, this command will work no matter which host is executing it. you need PsExec for commands that you can not execute on any host, and must be executed by the host of interest. for example, if you are on host A, and you need host B to ping host C, you must use PsExec on host A to instruct host B to ping host C. but if you are only manipulating the file system or registry of host B, then you can do that directly from host A.

i'm not saying PsExec is useless, you can do the copy by PsExec, but it's like scratching your left ear with your right hand shoved under your knee.

Share this post


Link to post
Share on other sites
shahino007

Now it works OK

Like the words of the great Homer Simpson: "Case Closed"

Thankes

Share this post


Link to post
Share on other sites

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
Sign in to follow this  

×