-1

How am I going to run a .bat file in background? And is there any possible way wherein every time I'm going to turn on my computer everyday the .bat file will automatically run and execute.I don't want to use startup or task scheduler and etc. because you still need to set it manually.

5
  • 1
    You have replied in comments below that you don't want to use startup or task scheduler to achieve this. Please edit your question to include these constraints, and explain why they are constraints, so that better answers can be provided.
    – Paul
    Commented Nov 10, 2014 at 22:19
  • 2
    You need to tell the PC when to run the task, and Startup or Task Scheduler are the tools that let you do so. If you do not want to use those tools, how should the PC decide when to run the task? You cannot just create a .bat file somewhere, and expect the PC to execute it when you wish.
    – hdhondt
    Commented Nov 11, 2014 at 3:28
  • 1
    Sorry, there is no Magic. You actually have to tell the computer, one way or another, what you want it to do, and when.
    – kreemoweet
    Commented Nov 11, 2014 at 3:33
  • why is it that visual wget can run immediately after the pc is turned on?It will run automatically upon log on. Is it because of the wget?
    – lovelyvm
    Commented Nov 12, 2014 at 6:04
  • @user An installation can set a program to run automatically. It can use the registry to do it, there are autorun "keys" for that. there
    – barlop
    Commented Dec 4, 2014 at 9:56

3 Answers 3

2

Right click My Computer, choose Manage. Under "Computer Management (Local)" to to System Tools -> Task Scheduler -> Task Scheduler Library.

Right click and choose Create Basic Task.

Give it a name, description, whatever. Click next, then for the trigger choose "When the computer starts". Click next.

Under the Action, choose "Start a program" and click next. Browse to your batch file, specify any arguments or Start-in locations necessary for it to run, then click next.

Tick the box that says "Open the Properties dialog for this task when I click Finish", then click Finish.

The default is run only when the user is logged on, so you'd have to log on before this batch file will run. If you want it to run before you log on, you probably want to change the option on the General tab to "Run whether the user is logged on or not". If the batch file needs network resources, you'll need to store your password, otherwise tick the "Do not store password" checkbox.

Then click Ok. Test, and enjoy!

2

Use startup or logon script. Group Policy allows you to associate one or more scripting files with four triggered events: Computer startup / shutdown and/or User logon / logoff. You can use Windows PowerShell scripts, or author scripts in any other language supported by the client computer. I think it accepts batch scripts as well...

The procedure might vary depending on your Windows version.

0

Put a link to the item to be run in the startup folder; Windows will run it on startup. For more advanced automation options, use Windows Task Scheduler.

Source: http://windows.microsoft.com/en-us/windows/run-program-automatically-windows-starts#1TC=windows-7

10
  • Is there any command or script to add in a .bat file to make it happen so that I don't need to use the start up as you suggested or the task scheduler?
    – lovelyvm
    Commented Nov 10, 2014 at 2:40
  • Double-clicking a batch file will run it. Am I misunderstanding what you are asking? Commented Nov 10, 2014 at 2:43
  • Yes but I wish to run the file automatically not by double clicking and etc.
    – lovelyvm
    Commented Nov 10, 2014 at 3:06
  • 2
    @ShaneDiDona Please do not post "link" answer. Summarise what you have found in the answer itself, and provide the link as a reference. This way, when the link stops working, the answer will still be helpful. Please read the help center for what consitutes a good answer.
    – Paul
    Commented Nov 10, 2014 at 3:15
  • 1
    There are no "commands," per se, to do this in Windows. Using Task Scheduler or the Startup folder (or if you really want to get unnecessarily fancy, the Registry's RUN keys) are your options for running your script in the way you require. Commented Nov 10, 2014 at 4:10

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .