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 :)
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
I have a script that imitates the war games logon and I was hoping to track the number of times an application has been open, so that way the script doesn't run every time I open a new terminal. Rather I would like it to run when I reboot the machine and open iTerm for the first time since reboot. Is there a way to track the number of times an application has been open since reboot? That way I can write a condition for an if statement.
If you want it to only execute once on boot, you could check for the existence (or not) of a specific file, and just touch it after it's opened for the first time, and delete it on shutdown or on startup before the full desktop/terminal window/environment loads in.
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
I need to back up some large files that are being written to disk by a process. The process is perpetually running, and occasionally dumps large files that need to be moved over the network. Having the process do this itself is not an option, as the process locks out users whilst it is doing file dumps.
So, this runs under a windows machine, and as a primarily linux user, I am not entirely certain how to do this...
Under linux I would simply use a cron job in the folder (I know the glob that will match the output files), then check lsof, to ensure that the file is not being written to, such that I don't try to copy a partially complete file. Data integrity is critical, so I would normally md5 the files before and after the copy.
So I guess my question is -- how does one do this sort of stuff under windows? I feel like I am kneecapped from the start -- I can use python, but I can't emulate lsof, nor cron to do the task scheduling.
I tried looking at "handle" -- but it needs admin privelidges at execution time, which is also not an option. I can't run the backup process as an admin, it has to run with user privs.
Thanks..
Edit: I just realised I could keep the python instance running, with a sleep, so task scheduling is not a problem :)
For replacing cron you can use the "Task Scheduler" in windows to start your script every few minutes (or specific times).
For lsof the question was discussed here : How can I determine whether a specific file is open in Windows?
I wrote a script in Ruby. I'd like to run it every day at a certain time. How do you do that on a Windows XP system?
I poked around on the machine and discovered the "scheduled tasks" control panel, but it doesn't seem to have anything to do with running scripts, as far as I can tell from the options offered by the "wizard".
Scheduled Tasks. Sometimes, you have to make a batch file call the script, and schedule the batch.
say you have "script.vbs" you want to run, you will have to create this batch:
cscript script.vbs
cscript is the windows script host which interprets the vbs script. I'm sure ruby has something similar.
You can do it with scheduled tasks, just browse for the program or script you want to run if it isn't listed (in this case, the ruby interpreter I guess, and add the name of the script to run as an argument).
Use the Windows task scheduler.
Under Control Panel > Schedule Tasks.
You can set it up to run any application or file executable from the command line.
Update: (1/15/09)
A good point from Wouter van Nifterick, remember to take care that the process finishes before the next one runs (in comments).
This can be done by going into the advanced options and adjust the allowed amount of time the task may run.
If the task is already configured open it and click the Settings tab. At the top of this tab you will see a checkbox followed by 'Stop the task if it runs for:' then there are two text boxes to enter hours and minutes. If your script runs once a day you will want this set to 23 hours or so.
The 'at' command is a nice command line version of a scheduler.