I want to create a .bat file and attach it to the boot processes so everytime I start the computer I wont have to execute the file.
This can be done with Task Scheduler.
Create a new task (don't use a basic task), for the trigger drop down (the default is scheduled) to At Startup.
You'll need to configure a user account to execute the batch file (likely there is no one logged in yet).
Related
I am trying to schedule a task that would run a simple batch file that runs some python script. The python script is a test that creates an empty text file. When I run the batch file the text file is created with no issues.
When I try to create a task with the scheduler and run it, nothing happens (whether I wait for the actual time or run manually). I changed the options to run with highers priviledge and denies access, even if I gave my account complete admin rights and added the user to the 'log on as a batch job' in local security policy.
Do you guys have any ideas as to why this is happening?
Are there any free applications that can do this same task?
Thanks
I found a good alternative that works for me, its simple and free: https://www.splinterware.com/
We have a legacy VB6 application that automatically emails reports. It runs from a scheduled task on a server. Occasionally a user will run the exe - it's in a folder that we can't lock them out of, and it has to remain in that folder for reasons too complicated to go into here. Is there a way to prevent users from running the exe while still letting it run from the scheduled task? I can modify the source code for the exe, so that's an option if someone can help me figure out how.
I'm going to call your existing app AppChild and a new VB6 (or other program language) program AppParent.
Modify AppChild to test for a command line parameter at either Sub Main() or at the first form loaded in the Form_Load() event. If the command line parameter isn't there, AppChild terminates.
AppParent would be in a location not accessible to the other users. The Scheduled task runs AppParent which runs AppChild and passes the required command line parameter. This could be secured somewhat by passing a calculated hash and decoding it in AppChild if needed.
Or, if the users don't have access to the Scheduled Tasks, you could just run AppChild , passing the required parameter from the Scheduled Task. If the users do have access to the Scheduled Task this won't work because they could then see the passed parameter and create a shortcut which passes the required parameter.
You didn't state which OS the server is running but you may have problems using network resources if you try to run the Scheduled Task without a logged in user. Task Manager got a major update to handle security issues to prevent hackers from running tasks without a logged in user. Essentailly, network resources, .e.g. eMail, are not available unless a user is logged in.
https://technet.microsoft.com/en-us/library/cc722152(v=ws.11).aspx
The only way I found around that problem is to run a machine with a user with the correct permissions logged in all the time.
Are you sure you cannot lock the user out?
You could restrict access to the folder so that the user cannot access it and set up the scheduled task to use an account with access to the folder.
Although the users can't be locked out of the folder (perhaps the reports end up in there?), in Windows you can set the permissions on a per file basis. Make a new user that has the full rights (the same as your users). Schedule the VB6 app to run with that user. Remove the rights for the regular users to see the app. You do this by changing the permissions on just the VB6 app.
I would like to launch script after windows service start or restart.
Like monitor wsupdate and at start or restart execute a batch script test.bat
Any ideas ?
That could be easily done with a scheduled task:
You just need to:
1) Start and Stop the Service to got the appropriate Events in the Eventlog.
2) taskschd.msc and create a new Costum Task. As Trigger you can select the Events created before with the start and/or stop action.
3) As Action call your cmd/bat, whatever you want.
Hint:
You also can export the Event in the XML Format, explained here:
http://blogs.technet.com/b/askds/archive/2011/09/26/advanced-xml-filtering-in-the-windows-event-viewer.aspx
and then import the XML Snippet into the Scheduld Task.
I have a batch file, which i'm wanting to run as System, as the program the batch runs refuses to run as an administrator account through scheduled tasks. As a last resort, i'm wanting to run the scheduled task as the local system account. The batch file needs to save files in a network path, which is specified in the batch file. The problem is that the system user doesn't seem to have the needed access to write to the network locations. How can i give the local system user access to write to the network path?
I'm using Ubuntu. I have two bash script files. Both will run in parallel. Now I want to continuously monitor on another file that it is running or not.
So any way to find that the file is currently executing or not ?
Numerous possibilities, it is a question of creativity...
Some suggestions:
periodically poll the process list and filter it by name or process id
start the script with control sockets, as long as the sockets are open the script runs
use the usual locking strategy in file system.
have the script do a lifebeat on a regular base, then watch that lifebeat.
start the script in a series of commands, the moment the script exists the next command will be executed by the calling shell. That one could be a notification script or something.
have the script do some wiggling on your desktop and watch it yourself.
start it using nohup and watch the log file.
implement a deamon inside the script and connect periodically.
open a file from within the script and watch the file system using the fuser system call.
periodically write a token into a file by the monitoring script and have the monitored script remove that token, like a baton.
call the script using a blocking call. The script executes as long as that blocking call does not return.
create a singleton strategy on process level and simply try starting it periodically.
make the monitoring script act as a monitor deamon the executing script connects to. If the connection is terminated the scipt obviously has stopped executing.
...
Sorry, this starts getting boring...