:next exit /b 0 ::Check Result :check fc /b st.txt stsuccess.txt > nul 2>&1 if…
- User
:next exit /b 0
::Check Result :check fc /b st.txt st_success.txt > nul 2>&1 if errorlevel 1 ( echo st.txt and st_success.txt are different. Restarting loop. timeout /t 10 /nobreak goto loop ) else ( echo st.txt and st_success.txt are the same. Stopping program. goto :end ) :end echo. echo Script finished process all target. pause
remove fc and change it to if time over 11.59am stop
- Assistant
To modify your script to stop processing if the current time exceeds 11:59 AM instead of checking for differences between
st.txtandst_success.txtusing thefccommand, you can use theTIMEcommand to retrieve the current time and compare it with your cutoff time.Here's an updated version of your script with that logic included:
@echo off :loop :: Check the current time for /f "tokens=1-2 delims=:" %%a in ("%time%") do ( set /a currentTime=%%a*60 + %%b ) :: Set cutoff time (11:59 AM) set cutoffTime=11*60 + 59 if %currentTime% geq %cutoffTime% ( echo Current time is past 11:59 AM. Stopping program. goto :end ) :: Your processing logic would go here echo Processing... timeout /t 10 /nobreak goto loop :end echo. echo Script finished processing all targets. pause - User
'+' is not recognized as an internal or external command, operable program or batch file.
- Assistant
The error you're encountering is because the batch scripting syntax for arithmetic operations does not allow the
+operator directly in thesetcommand without usingset /a. Here’s the corrected version of the script where I've usedset /aproperly for arithmetic calculations:@echo off :loop :: Check the current time for /f "tokens=1-2 delims=:" %%a in ("%time%") do ( set /a currentTime=%%a*60 + %%b ) :: Set cutoff time (11:59 AM) set /a cutoffTime=11*60 + 59 :: Enable delayed expansion setlocal enabledelayedexpansion if !currentTime! geq !cutoffTime! ( echo Current time is past 11:59 AM. Stopping program. goto :end ) :: Your processing logic would go here echo Processing... timeout /t 10 /nobreak goto loop :end echo. echo Script finished processing all targets. pause - User
If CheckSubject(Email) Then
' Execute any application (e.g., playsound.exe or run bat) Call RunAny("start /b cmd.exe /c D:\Sound_Alert\run-task.bat") ' Action if subject condition is met ' MsgBox "Alert: Subject contains specified keywords - " & Email.Subject, vbExclamation, "Subject Alert" End If - Assistant
- User
windows cannot file 'start'. make sure....
- Assistant