1

Currently, I want a remote machine (Amazon EC2 instance) to run a batch file when the machine starts up, and the batch file will close the machine after finishing the tasks.

I tried to put the shortcut of batch file to the startup folder. However, it will be only ran when I use Remote Control Connection to Log in that machine.

So, any other way to solve this problem??? NOTE: I don't want to log in to that machine since there might be 10 remote machines running at the same time.

Any idea or thought is appreciated. Thanks a lot.

user836112
  • 353
  • 3
  • 7
  • 14
  • possible duplicate of [Running Batch File in background when windows boots up](http://stackoverflow.com/questions/289498/running-batch-file-in-background-when-windows-boots-up) – wimh Nov 02 '11 at 07:36

2 Answers2

2

This looks a bit like the question Running Batch File in background when windows boots up, my answer there:

You can use autoexnt for this. It was original designed for windows NT, but is still working in newer versions of windows.

You have to download the Windows 2003 Resource Kit to get it.

Community
  • 1
  • 1
wimh
  • 15,072
  • 6
  • 47
  • 98
1

Windows XP (I believe Vista and 7 its the same as well, not sure about NT/2000)

Run gpedit.msc

Local Computer Policy -> Computer Configuration -> Windows Settings -> Scripts (Startup/Shutdown)

Open Startup. Click Add... Script Name: is where you input or Browse the location of your batch script to run. Script Parameters you can leave blank if you have no additional parameters you wish to pass w/it.

Anthony Miller
  • 15,101
  • 28
  • 69
  • 98
  • Hi, I tried your way. I added the script to the Startup, but it didn't run it when the machine starts. Any other configurations needed? My environment is win2008 server. Thanks a lot. – user836112 Nov 02 '11 at 21:37
  • Ai... I've never utilized 2008 server so I'm not sure if there are any additional setup needs. Questions however, is this script local (on the machine) or is it being accessed over the network? Does this script utilize the network in any way, i.e. fetches data over the internet/LAN/WAN? – Anthony Miller Nov 03 '11 at 16:09