Hi cats,
please consider that I launch a program .exe in a directory, for example c:\myprogram\cat.exe
I like do a batch that do this:
if exist a process in background called cat.exe ---> insert in a variable %var% the fullname and path of cat.exe
In my example %var% = c:\myprogram\cat.exe
but if - for example - I move cat.exe in e:\myprograms4 (so it become e:\myprograms4\cat.exe) the batch have
to pick up the new pathname so that %var% = e:\myprograms4\cat.exe
And if there are present 2 cat.exe processes ---> the batch have to pause and return a error ("Error: there are more of 1 cat.exe process detected!" --> and close all the batch)
How can I do? thanks
+ Reply to Thread
Results 1 to 3 of 3
-
-
Its a lot harder than you think, at least for DOS CLI method. You can get the pathsof all that are running by using such as:
Code:wmic process where "name='cat.exe'" get ExecutablePath /FORMAT:LIST
Code:wmic process where "name='cat.exe'" get ExecutablePath /FORMAT:LIST > "list.txt"
Code:findstr /R /N "^" List.txt | find /C ":"
Taskkill /IM cat.exe /F
SUCCESS: The process "cat.exe" with PID 7472 has been terminated.
SUCCESS: The process "cat.exe" with PID 6352 has been terminated.
SUCCESS: The process "cat.exe" with PID 10144 has been terminated.
http://tweaks.com/windows/39559/kill-processes-from-command-prompt/
The other method is to have an exe written to do specifically what you wish. Either way is not that quick or easy but it can be doneLast edited by Budman1; 11th Oct 2016 at 00:34.
Similar Threads
-
[SOLVED] "--ipratio" "--pbratio"+"--scenecut" "--minkeyint" / "--keyint
By Kdmeizk in forum Video ConversionReplies: 14Last Post: 21st Jun 2015, 07:21 -
Please help....... difficulty playing videos with "Variable Frame Rate"
By True Colors in forum Newbie / General discussionsReplies: 13Last Post: 19th May 2014, 01:32 -
the "-intra" command in ffmpeg.exe affects encoding "-vcodec copy" mode?
By marcorocchini in forum Newbie / General discussionsReplies: 1Last Post: 23rd Oct 2013, 15:53 -
Can I "update" MultiAVCHD by swapping the EXE files? (specifically x264)
By dvd3500 in forum Authoring (Blu-ray)Replies: 2Last Post: 3rd Mar 2013, 05:03 -
question about batchfile "taskkil" command for audiorepeater.exe
By Ennio in forum AudioReplies: 0Last Post: 12th Apr 2012, 10:17