How to open, wait & close the folder using batch file.

December 4, 2018 at 00:08:11
Specs: Windows 7
Hi, I'm trying to automate my manual stuff using batch file. I'm completely new to this.
Actually I have 5 folders to verify every day one after another manually. Actually I wanted to create a batch file to open 1st folder wait till 5 sec and close automatically after that immediately 2nd folder should open wait for 5 sec and close and repeat the process till 5th folder to open and close. Would any one help me with coding?

See More: How to open, wait & close the folder using batch file.

Reply ↓  Report •

#1
December 4, 2018 at 03:42:44
can do, but im busy right now, I should be done within 5 hours tho.

Could you provide the 5 folder names the script needs to check for you?
in this format:
C:\Users\%USERNAME%\AppData\Roaming

i5-6600K[delid]@4.8GHz/4.4GHz@1.424v LLC=6 | 2x4GB Crucial-DDR4-2133CL15@14-14-14-30 1T 2800MHz@1.37v
MSI Armor RX 570 4GB@1415Mhz core@1.2v/1920MHz


Reply ↓  Report •

#2
December 4, 2018 at 06:54:52
please enter the full paths to dir 1,2,3,4 and 5

save the below code as whatever.bat and run it.


@echo off&setlocal enabledelayedexpansion
for /f "skip=3 tokens=2" %%a in ('tasklist /FI "IMAGENAME eq explorer.exe"') do set dontkillme=%%a
set "dir1=C:\Example\thisdir"
set "dir2="
set "dir3="
set "dir4="
set "dir5="
for /l %%a in (1,1,5) do (
explorer.exe "!dir%%a!"
timeout 5 /NOBREAK >nul
taskkill /f /FI "IMAGENAME eq explorer.exe" /FI "PID ne !dontkillme!"
)

i5-6600K[delid]@4.8GHz/4.4GHz@1.424v LLC=6 | 2x4GB Crucial-DDR4-2133CL15@14-14-14-30 1T 2800MHz@1.37v
MSI Armor RX 570 4GB@1415Mhz core@1.2v/1920MHz

message edited by hidde663


Reply ↓  Report •
Related Solutions


Ask Question