Need batch file help

August 27, 2013 at 07:51:20
Specs: Windows 7

I am trying to piece together two batch files. The more I look at this the more I get the impression something is not quite right. I am trying to avoid redundant code. I have three sections in the batch file. Cleanup, filemove1 and filemove2. Filemove1 and filemove2 should be activated based upon the system type. The cleanup section should only run once. Can someone tell me how this is wrong and how it should be? Thanks.

If [%ERRORLEVEL%] == [0] (
echo X86
cd %systemroot%\system32
If exist "CleanupCompleted.txt" exit
) ELSE (
echo AMD64
cd %systemroot%\sysnative
If exist "CleanupCompleted.txt" exit


REM Get the Altiris Agent install path
FOR /F "tokens=2*" %%A IN ('REG.EXE QUERY "HKLM\Software\Altiris\Altiris Agent" /V "installdir"') DO SET AgentDir=%%B set tempbat=%temp%\AgentClean.bat"
REM Create temporary batch file to execute while the agent restarts echo "%AgentDir%\aexagentutil" /stop > %tempbat% echo rmdir "%AgentDir%\TaskManagement\cache" /s /q >> %tempbat% echo rmdir "%AgentDir%\TaskManagement\status" /s /q >> %tempbat% echo rmdir "%AgentDir%\TaskManagement\statusXml" /s /q >> %tempbat%
REM echo rmdir "%AgentDir%\TaskManagement\lti" /s /q >> %tempbat%
echo ping localhost -n 30 >> %tempbat%
echo "%AgentDir%\aexagentutil" /start >> %tempbat% echo exit >> %tempbat% REM Executes temporary batch file start "" /MIN %tempbat%
Set RegVar=HKLM\Hardware\Description\System\CentralProcessor\0
REG.exe Query %RegVar% 2>NUL | find /I /N "x86">NUL

COPY /Y "%~dp0\CleanupCompleted.txt" "%systemroot%\system32\CleanupCompleted.txt"

%systemroot%\sysnative\cmd.exe /c copy /y "%~dp0\CleanupCompleted.txt" "%systemroot%\system32\

See More: Need batch file help

Report •

August 28, 2013 at 09:20:12
You're missing the top part, and I'm not entirely sure why you're attempting to distinguish between x86 and x64.

How To Ask Questions The Smart Way

Report •

August 31, 2013 at 17:47:55
I was working on a similar project.

message edited by ksas

Report •

Related Solutions

Ask Question