|
Answer» I am trying to make a batchfile which copy's the my documents etc. from the currently logged in user on a other pc to a server. Whatever i try the output is de current user logged in where i type this batchfile so: set choice= set /P choice=PC number: if not "'%choice%'"=='' set choice=%choice:~0,99% e:\foldername\PsExec.exe \\%choice% RoboCopy "\\%choice%\c$\users\%USERNAME%\documents" "c:\temp\corne\Mijn documenten" /s /mir /log:C:\temp\RoboCopy1.Txt I am asked for a pcnumber and when i give that in the %username% is filled in with the currently logged in user locally and not from the pcnumber i gave in. I have tried it several WAYS also without the PsExec but with no effect. I KNOW this can be done with the set command or something but don'n know how?you can try running "qwinsta" using psexec.
It gives output of all loged on users. Look for console user and then when you have the username change to that users profile folder. Quote from: subhashchy on January 23, 2011, 05:23:35 PM you can try running "qwinsta" using psexec.
It gives output of all loged on users. Look for console user and then when you have the username change to that users profile folder.
I never heard of qwinsta but indeed you are right. When i run qwinsta the users logged in is displayed in the cmd prompt. But how di i make use of the username displayed? The batchfile must be run AUTOMATICALLY without need to SWITCH to the username. How can i do this in a batchfile?
|