- 1 year ago
How to stop/wait a Windows batch till powerpoint file loads in Browser
In a Windows batch file, you can use a loop to wait until a PowerPoint file loads in a browser. Here's an example of how you can accomplish this:
batch@echo off
REM Start the browser to load the PowerPoint file
start "" "C:\Program Files\Internet Explorer\iexplore.exe" "path\to\powerpoint.pptx"
REM Wait for the PowerPoint file to load
:WAIT
timeout /t 5 >nul 2>&1
REM Check if the browser process is still running
tasklist /FI "IMAGENAME eq iexplore.exe" | find /i "iexplore.exe"
if %errorlevel% == 0 (
REM Browser process is still running, continue waiting
goto WAIT
)
REM PowerPoint file has finished loading
echo PowerPoint file has loaded.
In this example, we start the Internet Explorer browser (iexplore.exe
) to load the PowerPoint file. Then, we use a loop with the timeout
command to wait for 5 seconds between each check. Inside the loop, we use the tasklist
command to check if the browser process is still running. If the browser process is still running, we continue waiting. Once the browser process is no longer found, it means that the PowerPoint file has finished loading, and we display a message indicating that.
Note: Replace "path\to\powerpoint.pptx"
with the actual path to your PowerPoint file. Also, keep in mind that this example uses Internet Explorer as the browser, but you can replace it with the appropriate browser executable if you're using a different browser.
Please adjust the paths and commands according to your specific environment and requirements.