Launch a program on boot - delayed, with no UAC.


  1. Posts : 4,776
    Microsoft Windows 7 Home Premium 64-bit 7601 Multiprocessor Free Service Pack 1
       #1

    Launch a program on boot - delayed, with no UAC.


    Hi,

    I've been looking for a way to launch programs on startup without installing any "startup delayer" type of software. This post has been edited to include the solution that was kindly provided by MilesAhead.

    Perhaps this method might suit other users.

    I started with a single program as a test. Other programs can be added to the batch file if needed.

    1). Create an elevated shortcut to the program. See: Elevated Program Shortcut without UAC Prompt - Create

    2). Create a batch file to launch the program with a delay and save the batch file in the following location:

    %Userprofile%\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup

    Launch a program on boot - delayed, with no UAC.-startupqueue2.jpg

    Example batch file (not for use on other machines):

    @echo off
    192.0.2.2 -n 1 -w 10000 > nul
    C:\Windows\system32\schtasks.exe /run /tn TASKNAME

    In the above example 10000 (milliseconds)sets the required delay of 10 seconds- use a higher or lower number if needed. Replace TASKNAME with the name of your task. You can find it in Task Scheduler. (Start > Run then type Taskschd.msc then click OK).

    Note: You may get better results if you substitute the line

    192.0.2.2 -n 1 -w 10000 > nul

    with

    ping -n 40 127.0.0.1 > NUL 2>&1

    For this test
    elevated_RegWatcher_rehctaWgeRJM2_xoblooTpotkseDsirhCsresUC is the task name as shown in Task Scheduler.

    Screenshot of Task Scheduler:

    Launch a program on boot - delayed, with no UAC.-task-scheduler.jpg

    If you have security software on your machine that might interfere with unknown files that attempt to run be sure to set it to trust the file that you created.

    Launch a program on boot - delayed, with no UAC.-trust-level.jpg

    Reboot.

    That's it.
    Last edited by Callender; 23 Jan 2015 at 13:44. Reason: add info
      My Computer


  2. Posts : 5,092
    Windows 7 32 bit
       #2

    ping for delay using 127.0.0.1 does not work as expected.

    scripting - How to wait in a batch script? - Stack Overflow

    relevant excerpt:

    NOTE: The 192.0.2.x address is reserved as per RFC 3330 so it definitely will not exist in the real world. Quoting from the spec:
    yadda yadda
      My Computer


  3. Posts : 4,776
    Microsoft Windows 7 Home Premium 64-bit 7601 Multiprocessor Free Service Pack 1
    Thread Starter
       #3

    Wait in batch script


    MilesAhead said:
    ping for delay using 127.0.0.1 does not work as expected.

    scripting - How to wait in a batch script? - Stack Overflow

    relevant excerpt:

    NOTE: The 192.0.2.x address is reserved as per RFC 3330 so it definitely will not exist in the real world. Quoting from the spec:
    yadda yadda

    Hi,

    Thanks very much indeed for the advice. The script that I'm using seems to work okay and I've tested using different delays.

    I got the suggestion here:

    command line - windows ping cmd help - Super User

    and looked here plus a few other places:

    command line - windows ping cmd help - Super User

    Also tried the following - neither of them worked:

    @echo off
    start "" "C:\Users\Chris\Desktop\Toolbox 2\MJRegWatcher\RegWatcher.exe"
    timeout /10

    @echo off
    start "" "C:\Users\Chris\Desktop\Toolbox 2\MJRegWatcher\RegWatcher.exe"
    timeout /t 10

    Then I tried using wait and sleep and also tried including RUNAS but nothing worked.

    If I understand you correctly I should use a non-existent address?
      My Computer


  4. Posts : 5,092
    Windows 7 32 bit
       #4

    If I understand you correctly I should use a non-existent address?
    Right. I was doing the same thing for a delay. I was only going for a 5 or 10 second delay. That's probably why I never noticed the discrepancy. In the link I posted this ping is used:
    ping 192.0.2.2 -n 1 -w 10000 > nul

    by using a non-existent address it allows you to use the -w param to get longer delays. As this person pointed out, if you use 127.0.0.1 that's the current host. It will answer the ping. So the -w will never time out. By using an IP guaranteed not to exist, the value for -w will time out on every ping. In his example to get a minute delay instead of 10 seconds you can change the -n value to 6 etc..

    I should have organized code snippets. If I did for batch, that would be one of them. :)
      My Computer


  5. Posts : 4,776
    Microsoft Windows 7 Home Premium 64-bit 7601 Multiprocessor Free Service Pack 1
    Thread Starter
       #5

    Launch a program on boot - delayed, with no UAC - Updated.


    I've just found another solution. Tested on my machine and working just fine.

    Software required:

    AUTORUN ORGANIZER 1.31 - Advanced Autorun Manager for Windows

    Alternate download:

    Download Autorun Organizer - MajorGeeks

    How to use:

    Create an Elevated Shortcut with no UAC prompt - to the program that you need to run on startup. See the tutorial here:

    Elevated Program Shortcut without UAC Prompt - Create

    Once you have created the Elevated Shortcut get the taskname from task scheduler. In this example I've created an Elevated Shortcut for the process Regwatcher.exe

    Launch a program on boot - delayed, with no UAC.-task-scheduler.jpg

    Then run Autorun Organizer by right clicking and choosing "Run as Administrator"

    In the window that opens click the "Add" button in the toolbar. Enter the path as shown:

    C:\Windows\system32\schtasks.exe /run /tn taskname

    If your taskname contains spaces - wrap the taskname in quotes.

    Give the Startup Entry a name.

    Launch a program on boot - delayed, with no UAC.-add-new-startup-entry.jpg

    Click "Forward"

    Choose a location for the entry - refer to the registry locations shown in Method 4 of the tutorial here:

    Startup Programs - Change

    Launch a program on boot - delayed, with no UAC.-add-new-startup-entry-2.jpg

    Add the desired location then click "Finish"

    Highlight the entry that you've just created and choose the required delay in seconds. Click the drop down arrow to manually input a delay.

    Launch a program on boot - delayed, with no UAC.-delay-load.jpg

       Tip

    You can right click any existing entry shown in the Autorun Organizer window and set a delay.


    A new task will be created and is shown in Task Scheduler under "DelayedItemsByChemtableSofware"

    Launch a program on boot - delayed, with no UAC.-task-scheduler-delayed-items.jpg

    Edit:

       Note

    Unfotunately once Autorun Organizer has done it's job and all delayed startup items have launched it will leave a process running in the background - StartupCheckingService.exe


    However you can actually use AutoRun Organizer to launch a delayed batch file to kill it's own running process.

    Here's how:

    Copy the following into notepad and save it somewhere handy as a batch file.

    Code:
    @echo off
    
    TASKKILL /F /IM StartupCheckingService.exe
    Add the batch file to the delayed startup list by adding it's file path.

    Launch a program on boot - delayed, with no UAC.-stop-autorun-organizer.jpg

    Choose a sufficient delay - the batch file must run only after all other delayed items have launched.
    Last edited by Callender; 22 Nov 2014 at 19:20. Reason: Add info
      My Computer


 

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

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