9

I have set up my computer to boot at the same time everyday when I am not home. I need it to run a batch file without anyone touching it right when it boots.

I have added a shortcut to the file in the "startup" folder. However, the script doesn't run until I log on and select the desktop from the metro interface.

Is there a way to have this script run without logging in?

4 Answers 4

0

You could use some of the windows utilities and turn a script into a service. I have done that before and there was information about doing this that was easily found.

More info: Best srvany.exe for Windows XP and Windows 7?

2
  • 1
    I used a tool called AlwaysUp as I could not find a means of turning a batch script into a service without use of a tool.
    – Kreuzade
    Feb 19, 2013 at 3:59
  • Found the reference about something that I had used to do this several years ago....it uses a Windows Server 2003 utility called srvany.exe. Here is some information on somebody using the process on Windows Server 2008: social.technet.microsoft.com/Forums/en-US/winserverMigration/…
    – mdpc
    Feb 19, 2013 at 6:17
9

If you have Windows 8 Pro, open the search charm for apps using Windows logo key‌+Q, type gpedit.msc and open the Local Group Policy Editor.

  • Under Computer Configuration / Windows Settings you'll find Scripts (Startup/Shutdown)

  • Under User Configuration / Windows Settings you'll find Scripts (Logon/Logoff)

Specify your batch file or PowerShell script here.

2
  • This seemed to work once I typed in my password, not before. Any way to make it happen before?
    – Kreuzade
    Feb 8, 2013 at 0:39
  • 1
    Logon scripts under User Configuration run with user-level credentials, so AFAIK the user has to log in first. You could try a startup script instead, or perhaps have the logon script execute after the password is entered (as above), but delay the desktop from being loaded until the script has completed executing. For this, Enable Computer Configuration / Administrative Templates / System / Scripts / Run logon scripts synchronously.
    – Karan
    Feb 8, 2013 at 0:53
0

Follw the steps on this URL. It shows you how you can also start a PowerShell script (which is more preferred instead of a batch script):

http://teusje.wordpress.com/2012/09/11/windows-server-logging-users-logon-and-logoff-via-powershell/

4
  • So how is this any different from what I posted? The exact same dialog allows you to specify batch files or PowerShell scripts. Also, link-only answers are not preferred here. To protect from link rot, always add as much as you can of the information here (but try not to plagiarise huge blocks of information word for word).
    – Karan
    Feb 8, 2013 at 18:33
  • ok, sorry my bad. it included screenshots, which make it sometimes easier + shows you also the powershell.
    – juFo
    Feb 10, 2013 at 12:16
  • 1
    If you think an existing answer can be improved with screenshots, just add them! Or at the very least you should add them to your answer.
    – Karan
    Feb 10, 2013 at 17:08
  • This is a bad answer. It sends you to a third-party site. I've seen several answers with broken links to third-party sites to know that the answer should be here, instead of in another site to be a valid answer. Dec 13, 2023 at 15:45
0

Did windows 8 do away with the Autoexec.nt file? When I have been lazy I have made a exe with rar with nothing but a batch file and needed programs. Then I set up that custom exe as a service. I have no idea if that can be done in 8. I know I shouldn't answer a question when I don't know the operating system, forgive me if I annoy.

You must log in to answer this question.

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