I have problem in my Windows2008R2 server, wich I use it like print server. Driver from Canon, CNABGSWK.EXE start in random times and fill my processor on 100% and all print jobs stopped.
Any idea how to stop/fix this?
Maybe with batch script, which always run in background and kill this process when it starts?
tnx
The only way to do this would be to either make a batch script to check if the process is running every X amount of seconds/minutes and kill it, or you can rename the file to something like CNABGSWK.EXE.BAK.
Some other Stack Overflow links to help you if you're making the script:
How to stop process from .BAT file?
How to check if a process is running via a batch script
Related
I am a beginner at developing Windows apps. I have created a VB script that executes the EXE file in background. I have referred some articles online and scheduled the script with windows scheduler. Now Every time I log in to the computer, the script starts running in the background normally as expected. The problem occurs when I lock the computer for a long period of time, somehow script gets killed by Windows. If I try to log in again, script(which got killed) doesn't start once again.
I want the script to run every time the computer gets unlocked no matter whether the computer was restarted/power-on/woke up from sleep and it should start running the script. But I am unable to achieve this.
This is what my current trigger looks like . Please tell me if I am doing something wrong
Is there a way in Windows OS to detect whether you program has been started from .bat or .lnk file and obtain the full path to it?
I know I can get the parent process, but how to detect... for the lack of a better term let's name it 'way'... the way a program has been started?
UPDATE
Some malware modifies .lnk file (adding an ad to its params) pointing to my app. Also it starts my app from .bat. I want to check hash of the .lnk file and just quit if it's been started from .bat.
Regards,
How does the program get started? Is it a SERVICE or does it run on startup?
If you killed the program, can you re-start it predictably?
I would use Processs Monitor to triangulate on what launched the app.
Process Monitor logs EVERYTHING the machine is doing. You can filter out all the noise to just .lnk, .bat, and/or your specific program.
Kill the program
Start Process Monitor (with filters applied)
Start the program
Stop Process Monitor
Search Process Monitor log by your program name
Scroll back to see what processes lead up to the program running
Hope it helps.
-Allen
Lets say I have One.exe and Two.exe. I would like to have a script that will run Two.exe as soon as One.exe is ran and finished loading.
Now, I was wondering what is the better way to do it:
have a script that will be started along with Windows and just sit
quietly in the background, listening for when One.exe will get
started and loaded.
Somehow attach a script to One.exe, so when it runs, the script runs
Two.exe
some other ideas that I don't have yet.
I haven't done any batch scripts yet, so I wanted get into the right way so I know what to search and read about.
Is my idea possible to get realized at all?
Add a simple delay after one.exe is launched with ping or timeout commands.
I have a windows batch file that is invoked by windows scheduler. When I try to have multiple windows scheduler tasks trying to run the batch file simultaneously, the batch file is locked by the first process and the all the other instances fail.
Is there is way in Windows to run multiple instances of batch file simultaneously?
My script is a simple one all it does is:
set java_classpath
java javaClass
There is nothing inherent to batch file mechanics that limits the number of processes that can simultaneously run the same script. The actual batch script is not locked when it is run. In fact, it is possible to modify a batch script while it is running, though that is usually a very bad idea.
But a batch script could take any number of actions that would prevent simultaneous runs. The most obvious is if the script attempts to redirect output to a specific file (constant path and name). The output redirection establishes an exclusive lock that will prevent any other process from obtaining the same lock.
Another possibility is your script could be calling an external command or program that establishes an exclusive lock in some way.
Either way, there should be nothing to prevent multiple processes from launching the same script simultaneously. But if the script establishes an exclusive lock, then one (or more) of the instances may either crash or exit prematurely, or seem to hang, depending on how the failed lock aquisition is handled.
There really isn't any way to be more specific unless you post your actual script. But if it is a long script, then you should attempt to isolate where the problem is occurring before posting.
Windows 8 task scheduler has the following option (on the last, "Settings" tab):
If the task is already running, then the following rule applies:
Do not start a new instance (default)
Run a new instance in parallel
...
Probably you should change this setting. And also, I would suggest you look into http://serverfault.com and post there.
Did you try calling your batchfile by using %systemroot%\cmd.exe /K C:\path\batchfile.bat? With /K each time a new instance of cmd is opened, guess it is the shell not the file making you weird.
to people coming here from google simply looking for a way to run multiple instances of a .bat file simultaneously, a simple way would be this script:
set N=3
for /L %%i in (1,1,%N%) do (
start yourscript.bat
)
I have a vb script (say myScript.vbs) which is used to monitor a file size (say A file) and trigger mail if it hits threshold size. I made this scipt to run on my computer.
But problem in this is, if the restart or log off and log in again, this script is not running behind.
How to make this script ever running, is it possible to add this script in Start up of windows??
You can add the script in Startup folder of Windows :)