I need a script to run in a window to monitor my folder. When I put a jpg file in this folder, then the script running in the window should
- open that jpg file with photoshop droplet (.exe),
- wait for a while and
- run to check .jpg files again.
The script I have now works, but I need to modify it.
I want the window to open jpg file with a random droplet that I created: it may be 5 droplets let's say I have 5 droplets that is 1.exe, 2.exe, 3.exe, 4.exe, 5.exe instead of just 123.exe droplet (this script). How do I do this?
@echo off
:loop
if exist "C:\Users\Administrator\Desktop\converted\*.jpg" (
for %%a in ("C:\Users\Administrator\Desktop\converted\*.jpg") do (
start "" /w "C:\Users\Administrator\Desktop\123.exe" "%%a"
ping -n 20 localhost >nul
del "%%a"
)
)
ping -n 60 localhost >nul
goto :loop
Edited on 27 May 2015 After Changing script I try move your script before "for loop" it's work but It's keep the same value in output, not random to every loop, please see my script
@echo off
:loop
set /a n=%random% %%5+1 ( <-- I move your line to this)
if exist "C:\Users\Administrator\Desktop\converted\*.jpg" (
for %%b in ("C:\Users\Administrator\Desktop\converted\*.jpg") do (
start "" /w "C:\Users\Administrator\Desktop\%n%.exe" "%%b"
ping -n 20 localhost >nul
del "%%b"
)
)
ping -n 60 localhost >nul
goto :loop