Unable to run batch file at startup


  1. Posts : 16
    Windows 10
       #1

    Unable to run batch file at startup


    I am trying to run a batch file with these contents:
    Code:
    ECHO OFF
    TIMEOUT /T 2 /NOBREAK
    DisplaySwitch.exe /internal
    TIMEOUT /T 2 /NOBREAK
    DisplaySwitch.exe /external
    I've tried putting a shortcut to it in the startup folder, putting the bat itself in the startup folder, and running it as a task using task scheduler. I also have UAC completely disabled. It runs fine when I run it myself, but it won't run at startup. How can I get to run when I start the computer?
      My Computer


  2. Posts : 127
    Windows 10 Pro
       #2

    Tried using Group Policy to run it? I have a little batch file that I use to delete logs running at shutdown, used GP to do it.
      My Computer


  3. Posts : 16
    Windows 10
    Thread Starter
       #3

    I wasn't familiar with group policy. I looked into it though, but I don't think I have it on my system. I though of something though. The purpose of my script is to change the primary display from the laptop screen to the external monitor. Is it possible that the script is running too early at startup?
      My Computer


  4. Posts : 127
    Windows 10 Pro
       #4

    robo731 said:
    I wasn't familiar with group policy. I looked into it though, but I don't think I have it on my system. I though of something though. The purpose of my script is to change the primary display from the laptop screen to the external monitor. Is it possible that the script is running too early at startup?
    Perhaps. Why do you need a script for that? I have several laptops running external monitors, everything is automatic.
      My Computer


  5. Posts : 13,848
    Win10 Version 22H2 Pro and Home, Win11 Pro and Home
       #5

    robo731 said:
    I wasn't familiar with group policy. I looked into it though, but I don't think I have it on my system.
    I think you need the Pro version of Win10 for GPEDIT. Your System Specs don't reflect whether you have Home or Pro.
      My Computers


  6. Posts : 16
    Windows 10
    Thread Starter
       #6

    wreckwriter said:
    Perhaps. Why do you need a script for that? I have several laptops running external monitors, everything is automatic.
    I use the laptop exclusively for video playback to a TV. When you turn the laptop on with the HDMI plugged in, the built in display is on, but blank. The only way to get the built in display to actually turn off is to set the primary to the built in display, then to the external.

    Berton said:
    I think you need the Pro version of Win10 for GPEDIT. Your System Specs don't reflect whether you have Home or Pro.
    Yeah, I know. I meant that my system is running home, so it doesn't have it.
      My Computer


  7. Posts : 127
    Windows 10 Pro
       #7

    robo731 said:
    I use the laptop exclusively for video playback to a TV. When you turn the laptop on with the HDMI plugged in, the built in display is on, but blank. The only way to get the built in display to actually turn off is to set the primary to the built in display, then to the external.



    Yeah, I know. I meant that my system is running home, so it doesn't have it.
    This page shows a few ways to insert delays in batch files, might help...

    How to insert delays in your batch files
      My Computer


  8. Posts : 16
    Windows 10
    Thread Starter
       #8

    I guess the delay was the issue. Instead of changing it in the batch file though, I just changed it in task scheduler. Instead of having it run at startup, I set it to run at logon of any user.
      My Computer


 

  Related Discussions
Our Sites
Site Links
About Us
Windows 10 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 10" and related materials are trademarks of Microsoft Corp.

© Designer Media Ltd
All times are GMT -5. The time now is 02:31.
Find Us




Windows 10 Forums