none
Copy Batch (.bat) file to startup Menu of All User/Each User RRS feed

  • Question

  • I have created a batch file(file1.bat) to run on every machine to create a batch file(file2.bat) to a launch a page at windows startup.

    This is the content of file1.bat:

    @echo off

    @echo>"C:\Users\User\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup\file2.bat
    @echo start http://www.msn.com/> C:\Users\User\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup\file2.bat

    Expected result is to copy the file2.bat to startup of each user profile.  However, The file2.bat is not copied to the startup folder on windows 7, 8, 10 after testing.

    However, this will work in file1.bat:

    @echo off

    @echo>"C:\Testing\file2.bat
    @echo start http://www.msn.com/> C:\Testing\file2.bat

    I do not have a domain joined network.  I need to send the file1.bat to all staff.  I plan to deploy to C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Startup. 

    Thanks in advance to all.  Any help is appreciated. 

    Monday, September 12, 2016 6:04 AM

Answers

All replies

  • Hello,

    use this path for startup menu:

    "%APPDATA%\Microsoft\Windows\Start Menu\Programs\Startup" (include quotes)

    Please, let us know.

    Monday, September 12, 2016 9:31 AM
  • Hi all, thanks for your response.  This is working("%APPDATA%\Microsoft\Windows\Start Menu\Programs\Startup").

    Can you help me to look at this?  I am trying to copy the same batch file(file1.bat) to all users startup. 

    This is the content of file1.bat:

    @echo off

    @echo>"%programdata%\Microsoft\Windows\Start Menu\Programs\Startup\file2.bat"
    @echo start http://www.msn.com/> "%programdata%\Microsoft\Windows\Start Menu\Programs\Startup\file2.bat

    Expected result is to copy the file2.bat to startup of all user profile.  However, The file2.bat is not copied to the startup folder on windows 7, 8, 10 after testing.  Very likely, the access is denied.  However, I am using a local admin account and File2.bat is not copied to C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Startup\.

    What to add into the script(in file1.bat) to run as an admin?  Any other suggestion to resolve this?  File2.bat is to launch a web page when machine startup

    Please guide me.  Thank you.





    • Edited by YZenh Tuesday, September 13, 2016 5:07 AM
    Tuesday, September 13, 2016 4:45 AM
  • Hello,

    you can try with Windows built-in TASK SCHEDULER.

    use this how to (credits to the author): http://www.sevenforums.com/tutorials/67503-task-create-run-program-startup-log.html

    Let us know.
    Tuesday, September 13, 2016 9:11 AM
  • Hi YZenh,

    In addition, we could try using "runas /user:administrator C:\data\mybatchfile.bat"

    Hope it will be helpful to you


    Please remember to mark the replies as an answers if they help and unmark them if they provide no help.
    If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com.

    Tuesday, September 13, 2016 9:32 AM
    Moderator
  • Hi, I wish to understand more. 

    "runas /user:administrator C:\data\mybatchfile.bat"

    administrator has to be an existing administrator account on local machine?  Where do I add this statement in which part of the code in file1.bat?

    Wednesday, September 14, 2016 10:12 AM
  • Just create another batch that call your first batch or use task scheduler like suggested

    SO "FILE0.BAT" wil be: "runas /user:administrator C:\data\file1.bat"

    Monday, September 19, 2016 8:09 AM