Have a .bat file start up as "run as administrator" in start up.

Page 1 of 2 12 LastLast

  1. Posts : 70
    Windows 10 Pro, 64 bit
       #1

    Have a .bat file start up as "run as administrator" in start up.


    Hi,

    Let me start with my setup. In File explorer I have a library called "Start up" . This contains 2 paths:
    Path 1
    C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Startup
    and Path 2
    C:\Users\AJ ANNING\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup

    I know the library is setup correct, I've used it for a long time with other .bat files.

    (Note: all screen shots are .jpg files attached and/or at
    www.aanning.com - /ajissues/Windows_errors/bat_file_startup/

    ss1.jpg is the shortcut in the library; ss2.jpg is the literaly .bat file
    )

    currently Path 1 is empty Path 2 contains a .bat shortcut called AOLSTART.BAT
    Which points to ""E:\Google Drive\APPS\BatchJobs\AOLSTART.BAT""
    As seen in ss1.jpg, this short cut is set to "run as administrator"
    The file AOLSTART.BAT is at E:\Google Drive\APPS\BatchJobs\ containing the below:

    cd /
    cd "C:\Users\AJ ANNING\AppData\Local\AOLDesktop"
    start Update.exe --processStart AolDesktop.exe

    timeout 2
    start outlook

    The issue is when I reboot, nothing happens, the shortcut AOLSTART.BAT does not work.
    If I use file explorer and navigate to my startup library and double click AOLSTART.BAT it works fine.
    (Initnally I had to right click, run as adminstrator, else it did nothing, so in
    the properties I set it to run as admin...as seen in ss1.jpg).

    I have tried to go directly to AOLSTART.BAT in E:\Google Drive\APPS\BatchJobs\ to set it up
    to run as administrator...this is not an option here? (see ss2.jpg)
    I'm guessing during reboot is may need the shortcut AND the .bar file as "run as administrator"
    even though insticnt tells me, if the shortcut is set up to default run as administrator
    that should cover it ? This may not be the issue, all I want is AOLSTART.BAT to run, please advise.
    thanks AJ
    Have a .bat file start up as "run as administrator" in start up.-ss1.jpgHave a .bat file start up as "run as administrator" in start up.-ss2.jpg
      My Computer


  2. WOT
    Posts : 471
    Win 10 Pro 15063.332 (ex-Insider)
       #2
    Last edited by Brink; 21 May 2017 at 08:17. Reason: added tutorial link for more info
      My Computers


  3. Posts : 70
    Windows 10 Pro, 64 bit
    Thread Starter
       #3

    Yes the short cut only exists in the Startup library at: (keep in mind the shortcut and .bat are both named AOLSTART.BAT)
    C:\Users\AJ ANNING\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup

    I copied the literal .bat file aolstart.bat to the startup library path
    :
    C:\Users\AJ ANNING\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup

    This does work at reboot, however, I'd prefer the shortcut work for me, so I can edit the .bat in
    its designated storage area where all my .bat are (E:\Google Drive\APPS\BatchJobs\)
      My Computer


  4. Posts : 1,524
    Windows 10 Pro (32-bit) 16299.15
       #4

    Is E:\Google Drive a physical drive or something which is created/sync-ed at startup?
    I'm wondering if it tries to run the BAT file before it runs whatever creates that drive, so that E:\Google Drive doesn't exist at that point - could that be happening?

    Personally I would use Task Scheduler to create a task and set a few minutes' delay on it.
      My Computer


  5. Posts : 5,452
    Windows 11 Home
       #5

    This is a more reliable path, but you should create a shortcut to BAT, set it to run as admin and place it there.

    %ProgramData%\Microsoft\Windows\Start Menu\Programs\Startup

    DavidY said:
    Personally I would use Task Scheduler to create a task and set a few minutes' delay on it.
    Indeed, this is the best option, you can setup a delay, run it as admin in background and etc.
      My Computer


  6. Posts : 70
    Windows 10 Pro, 64 bit
    Thread Starter
       #6

    Why do you say one of the paths are more reliable than the other? they are both startups. (I do wonder if one is better than the other..and don't know why it would or would not be). I had tried both paths before opening this thread, neither works with the short cut...both do work with the literal .bat file.
    Funny you mention, task scheduler ...that's exactly what I was doing before reading your reply. It does work in task scheduler doing right click, run. I have not had a chance to reboot and test.
    The two options i'm looking at are "at logon" and "at startup". "at logon" would run the bat everytime I logon...I do not want this.
    Since i only want this to start on a reboot, or cold start...I think "at start up"
      My Computer


  7. Posts : 70
    Windows 10 Pro, 64 bit
    Thread Starter
       #7

    I think this is 'it'....I ended up making a much more than "jus start AOL" bat file, it can me seen at:


    http://www.aanning.com/ajissues/Wind...p/aolstart.txt


    not bad for just throwing this together since we begin talking


    Thanks for your help!
      My Computer


  8. Posts : 1,524
    Windows 10 Pro (32-bit) 16299.15
       #8

    Janning said:
    Funny you mention, task scheduler ...that's exactly what I was doing before reading your reply. It does work in task scheduler doing right click, run. I have not had a chance to reboot and test.
    The two options i'm looking at are "at logon" and "at startup". "at logon" would run the bat everytime I logon...I do not want this.
    Since i only want this to start on a reboot, or cold start...I think "at start up"
    I haven't read the batch file to figure out what you're trying to do, but possibly at startup. As there are a lot of tasks which run at startup I sometimes put a delay on when I do this, although I've not had any luck with the option to wait until the computer is idle.
    My tip for the delay is that the dialog box doesn't always allow the delay you want but if you export the task, edit the xml file , and re-import, you can have a delay of, for example, 2 minutes which ostensibly isn't allowed.
      My Computer


  9. Posts : 70
    Windows 10 Pro, 64 bit
    Thread Starter
       #9

    At first I only wanted to have it start AOL, on startup, save me a click or two. Then I decided to have it go ahead and start outlook, Google, and facebook...places I know that some point during the day I will for certain be going. I'm sure I'll add others as time goes by, at least now i have a good template to work with.

    I don't know about you? but, using idle as a trigger for me would never work, as I doubt mine is ever truly "idle". Sounds like for you, the re-import is actually completing a setting the GUI is not doing? I'm by far no tasks scheduler expert at all, but, what little i've dealt with it...I've noticed it had bugs. (back in XP days anyway, surely they've corrected the issue I was having...been too long to tell you details on that one). TWO minutes delay ?...wow, thats an eternity. I'm using some real heavy resource tools (ie Quest's TOAD)...and 15 seconds was plenty enough delay for even TOAD to get sorted out. I can't imagine why you'd need 2 minutes. I'm sure you have good reason...but, if its to wait for something to fire up before continuing ...I'd hate to have to work in that app! Using all Solid state drives really helped out for me. With a SSD, it can do a lot in 10 seconds!.
      My Computer


  10. Posts : 1,524
    Windows 10 Pro (32-bit) 16299.15
       #10

    Janning said:
    TWO minutes delay ?...wow, thats an eternity. I'm using some real heavy resource tools (ie Quest's TOAD)...and 15 seconds was plenty enough delay for even TOAD to get sorted out. I can't imagine why you'd need 2 minutes.
    I still use a 10 year old laptop, with too much clutter installed over the years happening at startup. (I'm awaiting a driver fix from Microsoft before I can clean install the latest Windows 10 version which should improve things.) This thing has an IDE disk (not even SATA) so it's some way away from an SSD...
    Mind you I have another newer laptop (but still a spinning disk) where there's still a lot going on at Startup, not helped by the anti-virus I'm using, which seems to aggressively hog system resources.
      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 10:43.
Find Us




Windows 10 Forums