Jump to content
Sign in to follow this  
Briandr

run batch as part of autoit executable

Recommended Posts

Briandr

Hi,

I think this can be done, but how would I convert the batch code below into autoit code and then run it silently?

REM Get the Altiris Agent install path
FOR /F "tokens=2*" %%A IN ('REG.EXE QUERY "HKLMSoftwareAltirisAltiris 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%TaskManagementcache" /s /q >> %tempbat%
echo rmdir "%AgentDir%TaskManagementstatus" /s /q >> %tempbat%
echo rmdir "%AgentDir%TaskManagementstatusXml" /s /q >> %tempbat%
REM echo rmdir "%AgentDir%TaskManagementlti" /s /q >> %tempbat%      -- remove away the REM, from this line only if you are running on 7.1 and above
echo ping localhost -n 30 >> %tempbat%
echo "%AgentDir%aexagentutil" /start >> %tempbat%
echo exit >> %tempbat%

REM Executes temporary batch file
start "" /MIN %tempbat%
 
Thanks.

Share this post


Link to post
Share on other sites
JLogan3o13

Hi, Briandr. Here are some hints:

FOR /F "tokens=2*" %%A IN ('REG.EXE QUERY "HKLM\Software\Altiris\Altiris Agent" /V "installdir"') DO SET AgentDir=%%B
    ;Look at Registry Management in the help file 
 
 set tempbat=%temp%\AgentClean.bat"
    ;This is just a variable, $tempbat = <path>
 
 echo "%AgentDir%\aexagentutil" /stop > %tempbat%
    ;Look at RunWait or ShellExecuteWait in the help file
    
 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%      -- remove away the REM, from this line only if you are running on 7.1 and above
    ;Look at DirRemove in the help file (sensing a pattern?)

echo ping localhost -n 30 >> %tempbat%
    ;Look at Ping in the help file
    
 echo "%AgentDir%\aexagentutil" /start >> %tempbat%
    ;Look at RunWait or ShellExecuteWait in the help file
    
 start "" /MIN %tempbat%
    ;Look at RunWait or ShellExecuteWait in the help file
Edited by JLogan3o13

√-1 2^3 ∑ π, and it was delicious!

How to get your question answered on this forum!

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×