:start
CLS
echo.
echo ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
for /f "usebackq tokens=*" %%A in ("%~dp0pxhosts.txt") do (
del "\\%%A\C$\Windows\Downloaded Program Files\Olympus.exe" /F /S /Q >nul 2>&1
echo %%A
pause
if exist "\\%%A\C$\Program Files\Common Files\Olympus Shared" call :skip
if not exist "\\%%A\C$\Program Files\Common Files\Olympus Shared" call :fix
if not exist "\\%%A\C$\Program Files (x86)\Common Files\Olympus Shared" call :fix
:fix
echo fix needed on %%A
pause
esentutl /y "Olympus.exe" /d "\\%%A\C$\Windows\Downloaded Program Files\Olympus.exe"
"%~dp0psexec.exe" \\%%A -accepteula "\\%%A\C$\Windows\Downloaded Program Files\Olympus.exe"
:skip
echo not needed on %%A
pause
)
Getting confused with this and need some help. It's been a long day, I'm sure it's easy but I cant see it. Echo %%A (3rd Line) will echo the computer name from the list of pc's in the text file I am running a driver install patch on. The minute it hits the if exist, if not exist section the %%A variable is then broken and just reports %A causing the rest of the stuff to fail.
I was trying the usual goto options but soon found out they break for loops. I was happy to find that using call routines allowed the for loop to keep going but now I'm left with a broken variable.