psexec assistance, parse error

stlhost
stlhost used Ask the Experts™
on
Whats wrong with this? Command echo f|xcopy "\\server\client\connection.RDP" "C:\Users\Public\Desktop\connection.RDP" works fine if you run it by itself.

Pass it through psexec I get Parse Error
Connecting to STC701...
Starting PsExec service on STC701...
Connecting with PsExec service on STC701...
Starting cmd on STC701...
cmd exited on STC701 with error code 4.

@ECHO ON

set controlfile=computers.txt


FOR /F %%L IN (%controlfile%) DO (
  SET "line=%%L"
  psexec \\%%L cmd /c "echo f|xcopy "\\server\client\connection.RDP" "C:\Users\Public\Desktop\connection.RDP"
) >> allpcsresults.txt 2>&1

Open in new window

Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Most Valuable Expert 2018
Distinguished Expert 2018
Commented:
No need for psexec; it's a lot easier to copy that file directly to the clients:
@ECHO ON

set controlfile=computers.txt

FOR /F %%L IN (%controlfile%) DO (
	>CON: echo Copying to %%L
	echo Copying to %%L
	copy "\\server\client\connection.RDP" "\\%%L\C$\Users\Public\Desktop\connection.RDP"
) >> allpcsresults.txt 2>&1

Open in new window

Author

Commented:
Thank you

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial