Batch Script
Hi
Please give me batch script that search for .exe file
if file is present then it should execute that .exe file
if no it should quit
Regards,
Sarika
2 Comments
[ + ] Show comments
Answers (1)
Please log in to answer
Posted by:
captain_planet
6 years ago
set log_file_path="%TEMP%\%~n0.log"
::Delete the current log file
if exist %log_file_path% del /Q %log_file_path%
::DEFAULT: silent Installation
::========================================================================================
::Helper Functions
::========================================================================================
goto END_FUNCTION_SECTION_
::---------------------------------
::Performs Installation
::---------------------------------
:funcInstall
setlocal
set ERROR_SUCCESS=0
:if not exist"%windir%\system32\CompattelRunner.exe"
:GOTO:EOF
if exist "%windir%\system32\CompattelRunner.exe"
start schtasks.exe /CHANGE /TN "Microsoft\Windows\Application Experience\Microsoft Compatibility Appraiser" /DISABLE
if %errorlevel%==%ERROR_SUCCESS% goto SUCCESS_
:ERROR_
::------------------------------------------
::print out Machine Name, product code, product name
::to the network log file for the product that failed to uninstall
set Installation_result=Failed, Result=%errorlevel%
goto DONE_
:SUCCESS_
REG ADD "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Brand_MSCompatabilityAppraiser_DisableTask
set Installation_result=Succeeded
goto DONE_
:DONE_
endlocal
GOTO:EOF
:END_FUNCTION_SECTION_
::::== Defender Update
call :funcInstall - SR02656 6 years ago