I am trying to run a batch file against a list of remote computers.
The batch file will check for a specific file, if the file is not found in the directory it should be copied there.
I am using the %%a variable for the PC names.
The xcopy command fails in the batch file with invalid drive specification.
If I take the xcopy command and replace the variable with the computer name and run from a command prompt it will copy the file over.
I am not sure why the xcopy command fails in the batch file when using %%a
PC.txt is my text file with the list of computers.
I am using the hostname and not the FQDN in the text file
for /f %%a in (PCList.txt) do (
If Exist "\\%%a\c$\Program Files\Folder\App.exe" (
ECHO %%a App.exe exists
) ELSE (
ECHO %%a App.exe Does Not Exist
xcopy "C:\Folder\App.exe" "\\%%a\c$\Program Files\SubFolder\" /Q /R /Y
)on that?