Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.
Batch Check File is Opened
Name: davi albuquerque Date: November 25, 2008 at 10:13:09 Pacific OS: Windows XP CPU/Ram: q6600/4gb Product: PC
Comment:
Hi,
I have a "software.bat" on windows xp, but sometimes users open 2 times and system stay slow. how i check if file is opened?
Name: klint Date: November 26, 2008 at 04:43:50 Pacific
Reply:
Here's my suggestion. Perhaps someone else can come up with a better idea.
My technique assumes that this batch file will run under its own window (e.g. by double-clicking the file in Windows Explorer) and will have a unique window title, except if another instance of the same file is already running.
When the batch file stops running, you must ensure the window is closed, to allow other instances of the batch file to run.
title %~nx0 setlocal set /a numProcs = 0 for /f %%a in ('tasklist /nh /fi "windowtitle eq %~nx0"') do ( set /a numProcs += 1 ) if not %numProcs% == 1 ( echo Another instance of this batch file is already running. exit /b 1 )
0
Response Number 2
Name: davi albuquerque Date: November 27, 2008 at 06:29:54 Pacific
Summary: Hello I'm writing an alarm app. in Java. One of the alarms check continuously if a given file is opened by another app. and warning the user (with a 'beep' and a message) if this happens. I'm using a ...
Summary: Write a batch file to do just one iteration of the task. Then run this batch file every 15 minutes by using the Windows XP Task Scheduler. Alternatively, have a batch file that calls this one in a loo...
Summary: I'm wondering if there is a way to create a batch file that opens a network drive. Here's my situation, I have a user that is connecting to our network via VPN, we do not have network drives mapped ...