Windows run bat file at startup

Is there a way to start multiple programs in a batch file on system start-up? In addition to that, in that batch file, I would like to be able to say: Once I execute a program, wait until that prog...

Is there a way to start multiple programs in a batch file on system start-up? In addition to that, in that batch file, I would like to be able to say: Once I execute a program, wait until that program completely loads, and execute the next listed program.

Any help would be appreciated.

asked Jan 19, 2014 at 15:00

Randomishlying's user avatar

RandomishlyingRandomishlying

1,1512 gold badges9 silver badges15 bronze badges

2

I had the same issue in Win7 regarding running a script (.bat) at startup (When the computer boots vs when someone logs in) that would modify the network parameters using netsh. What ended up working for me was the following:

  1. Log in with an Administrator account
  2. Click on start and type “Task Scheduler” and hit return
  3. Click on “Task Scheduler Library”
  4. Click on “Create New Task” on the right hand side of the screen and set the parameters as follows:

    a. Set the user account to SYSTEM

    b. Choose «Run with highest privileges»

    c. Choose the OS for Windows7

  5. Click on “Triggers” tab and then click on “New…”
    Choose “At Startup” from the drop down menu, click Enabled and hit OK
  6. Click on the “Actions tab” and then click on “New…”
    If you are running a .bat file use cmd as the program the put
    /c .bat
    In the Add arguments field
  7. Click on “OK” then on “OK” on the create task panel and it will now
    be scheduled.
  8. Add the .bat script to the place specified in your task event.
  9. Enjoy.

answered Jul 28, 2015 at 17:32

prankin's user avatar

2

To run a batch file at start up: start >> all programs >> right-click startup >> open >> right click batch file >> create shortcut >> drag shortcut to startup folder.

The path to the folder is : [D|C]:Profiles{User}‌​AppDataRoamingMicro‌​softWindowsStart MenuProgramsStartu‌​p

Charles Follet's user avatar

answered Jan 19, 2014 at 15:07

Troubleshoot's user avatar

TroubleshootTroubleshoot

1,8061 gold badge12 silver badges19 bronze badges

9

Go to Run (WINDOWS + R) and
Type
shell:startup, paste your .bat file there !

answered Jan 23, 2019 at 13:26

Milan Madubasha's user avatar

3

To start the batch file at the start of your system, you can also use a registry key.

HKEY_LOCAL_MACHINESOFTWAREMicrosoftWindowsCurrentVersionRun

Here you can create a string. As name you can choose anything and the data is the full path to your file.

There is also the registry key

HKEY_LOCAL_MACHINESOFTWAREMicrosoftWindowsCurrentVersionRunOnce

to run something at only the next start of your system.

answered Oct 8, 2014 at 8:13

Rainer Zufall's user avatar

0

There are a few ways to run a batch file on start up. The one I usually use is through task scheduler. If you press the windows key then type task scheduler it will come up as an option (or find through administerative tools).

When you create a new task you can chose from trigger options such as ‘At log on’ for a specific user, on workstation unlock etc. Then in actions you select start a program and put the full path to your batch script (there is also an option to put any command line args required).

Here is a an example script to launch Stack Overflow in Firefox:

@echo off

title Auto launch Stack Overflow


start firefox http://stackoverflow.com/questions/tagged/python+or+sql+or+sqlite+or+plsql+or+oracle+or+windows-7+or+cmd+or+excel+or+access+or+vba+or+excel-vba+or+access-vba?sort=newest

REM Optional - I tend to log these sorts of events so that you can see what has happened afterwards
echo %date% %time%, %computername% >> %logs%StackOverflowAuto.csv

exit

answered Jan 19, 2014 at 15:09

ChrisProsser's user avatar

ChrisProsserChrisProsser

12.3k6 gold badges36 silver badges44 bronze badges

1

RunOnce

RunOnce is an option and have a few keys that can be used for pointing a command to start on startup (depending if it concerns a user or the whole system):

HKEY_LOCAL_MACHINESoftwareMicrosoftWindowsCurrentVersionRun
HKEY_CURRENT_USERSoftwareMicrosoftWindowsCurrentVersionRun
HKEY_LOCAL_MACHINESoftwareMicrosoftWindowsCurrentVersionRunOnce
HKEY_CURRENT_USERSoftwareMicrosoftWindowsCurrentVersionRunOnce

setting the value:

reg add "HKEY_CURRENT_USERSoftwareMicrosoftWindowsCurrentVersionRunOnce" /v MyBat /D "!C:mybat.bat"

With setting and exclamation mark at the beginning and if the script exist with a value different than 0 the registry key wont be deleted and the script will be executed every time on startup

SCHTASKS

You can use SCHTASKS and a triggering event:

SCHTASKS /Create /SC ONEVENT /MO ONLOGON /TN ON_LOGON /tr "c:some.bat" 

or

SCHTASKS /Create /SC ONEVENT /MO ONSTART/TN ON_START /tr "c:some.bat"

Startup Folder

You also have two startup folders — one for the current user and one global.
There you can copy your scripts (or shortcuts) in order to start a file on startup

::the global one
C:ProgramDataMicrosoftWindowsStart MenuProgramsStartUp
::for the current user
%USERPROFILE%AppDataRoamingMicrosoftWindowsStart MenuProgramsStartup

answered Nov 10, 2020 at 0:16

npocmaka's user avatar

npocmakanpocmaka

54.5k18 gold badges147 silver badges183 bronze badges

1

1. Copy the following lines to Notepad.

Set WshShell = CreateObject("WScript.Shell") 
WshShell.Run chr(34) & "C:Userstotoyour_file.bat" & Chr(34), 0
Set WshShell = Nothing

Note: Replace the batch file name/path accordingly in the script according to your requirement.

2. Save the file with .VBS extension, example launch_bat.vbs

3. Create new .bat file, in our case your_file.bat

4. Write the content of your .bat file.
Example:

 @echo off
    php c:laragonwwwmy_appartisan serve --host=127.0.0.1 --port=8000

5. Run your_file.bat and ejoy :)

answered Apr 5, 2021 at 16:29

Gustave Tsopmo's user avatar

If your Windows language is different from English, you can launch the Task Scheduler by

  1. Press Windows+X
  2. Select your language translation of «Computer Management»
  3. Follow the instruction in the answer provided by prankin

answered Mar 21, 2019 at 8:52

Peer Sommerlund's user avatar

Another option would be to run the batch file as a service, and set the startup of the service to «Automatic» or «Automatic (Delayed Start)«.
Check this question for more information on how to do it, personally I like NSSM the most.

answered May 6, 2019 at 14:06

GChuf's user avatar

GChufGChuf

75013 silver badges28 bronze badges

On previous versions of Windows I have used the below technique to run a batch file on Windows startup.

  1. Create a shortcut to the batch file.
  2. Once the shortcut is created, right-click the shortcut file and select Cut.
  3. Click Start, then Programs or All Programs. Find the Startup folder and right-click that folder, then select Open.
  4. Once the Startup folder is opened, click Edit in the menu bar, then Paste to paste the shortcut file into the Startup folder. If you do not see the menu bar, press the Alt key to make the menu bar visible.
    Any shortcuts in the Startup folder will automatically run each time the user logs in to Windows.

I have been unsuccessful in finding how to do something similar on Windows 10.

Any ideas?

asked Aug 10, 2015 at 20:20

baynezy's user avatar

baynezybaynezy

1,3212 gold badges10 silver badges9 bronze badges

2

The startup folder is still there and functions as normal.

To access it, press Windows+R, then type shell:startup.

You should be able to do what you were previously doing in Windows 7 from there.

answered Aug 10, 2015 at 20:43

7

You can use scheduled tasks and set it to run at startup.

Go to ManageScheduled TasksCreate a Basic Task.

Once at the dialog box, set a name, click Next and select at startup, Next again and select the program you want to run and next to finish. Done!

Peter Mortensen's user avatar

answered Aug 10, 2015 at 20:59

sarakusta's user avatar

sarakustasarakusta

4633 silver badges4 bronze badges

1

If you don’t have access to Windows+X functionality, you can navigate manually to the two startup folders:

  • User: C:UsersUSERAppDataRoamingMicrosoftWindowsStart MenuProgramsStartup
  • All users: C:ProgramDataMicrosoftWindowsStart MenuProgramsStartUp

Here’s a useful batch file to open either or both of these folders:

rem Load the current user Start folder
%SystemRoot%explorer.exe "%APPDATA%MicrosoftWindowsStart MenuProgramsStartup"

rem Load the "All Users" Start folder
%SystemRoot%explorer.exe "%ALLUSERSPROFILE%MicrosoftWindowsStart MenuProgramsStartUp"

Note: Above applies to Windows 8.1 and Windows 10 (and maybe earlier versions).

answered Jan 20, 2020 at 13:00

AlainD's user avatar

AlainDAlainD

4,19015 gold badges43 silver badges92 bronze badges

3

To add to user314352’s answer:

The startup folder is still there and functions as normal.

To access it, press Windows+R, then type shell:startup.

You should be able to do what you were previously doing in Windows 7 from there.

You can also type shell:common startup to access the startup folder for all users.

answered Dec 26, 2020 at 11:05

Azeezah M's user avatar

Azeezah MAzeezah M

611 silver badge1 bronze badge

I have an MSI motherboard that is not playing nice with my beloved Gateway Anykey keyboard. Num Lock won’t turn off at boot.

I added a «NumLock Off» utility to the shell:startup folder. No help. I added it to Scheduled Tasks and that worked. BTW, I couldn’t schedule a shortcut to the utility. I could only schedule a batch file with the numlock.exe file and the «off» parameter on the command line.

Peter Mortensen's user avatar

answered Nov 20, 2016 at 3:40

Al Pomey's user avatar

1

Alternative through Group Policy

gpedit: Local Computer Policy > Computer Configuration > Windows Settings > Script (Startup/Shutdown)

answered Jun 2, 2021 at 9:04

user.dz's user avatar

user.dzuser.dz

6487 silver badges19 bronze badges

Updated: 08/31/2020 by

Batch file

You may need to run a batch file to configure devices, delete or copy files, or perform other tasks each time the computer loads to help it run more efficiently or allow a device to run. Below are steps on how to make any batch file run each time you boot into Windows.

Note

If there are two or more user accounts on the computer, the batch file runs after the user logs in to Windows.

Run a batch file at loading of Windows 8 and 10

  1. Create a shortcut to the batch file.
  • How to create a Windows shortcut.
  1. Once the shortcut is created, right-click the shortcut file and select Cut.
  2. Press Start, type Run, and press Enter.
  3. In the Run window, type shell:startup to open the Startup folder.
  4. Once the Startup folder is opened, click the Home tab at the top of the folder. Then, select Paste to paste the shortcut file into the Startup folder.

Run a batch file at loading of Windows 98, XP, NT, 2000, Vista, and 7

  1. Create a shortcut to the batch file.
  • How to create a Windows shortcut.
  1. Once the shortcut is created, right-click the shortcut file and select Cut.
  2. Click Start, then Programs or All Programs. Find the Startup folder and right-click that folder, then select Open.
  3. Once the Startup folder is opened, click Edit in the menu bar, then Paste to paste the shortcut file into the Startup folder. If you do not see the menu bar, press the Alt to make the menu bar visible.

Any shortcuts in the Startup folder automatically run each time the user logs in to Windows.

Run a batch file at loading of Windows 95, 3.x, and MS-DOS

The autoexec.bat file is in the root directory of the C: drive (C:autoexec.bat). Place a line in your autoexec.bat that calls the batch file each time you want to boot the computer, as shown below.

CALL C:myfile.bat

In the example above, each time your computer starts and processes the autoexec.bat file, it runs the batch file myfile.bat.

Note

The autoexec.bat is only available with early versions of Windows and is not available or used in any version of Windows after Windows XP.

Содержание

  • Способ 1: Папка автозапуска
  • Способ 2: «Редактор реестра»
  • Способ 3: Планировщик заданий
  • Способ 4: Локальные групповые политики
  • Вопросы и ответы

Как добавить батник в автозагрузку Windows 10

Способ 1: Папка автозапуска

Методы добавления в автозагрузку скрипта BAT ничем не отличаются от методов добавления в автозагрузку ярлыков и других файлов. Самым простым и очевидным является копирование файла батника в папку автозапуска.

  1. Откройте папку автозапуска, для чего выполните в вызванном клавишами Win + R окошке команду shell:Startup.
  2. Как добавить батник в автозагрузку Windows 10-1

  3. Скопируйте в открывшийся каталог файл BAT.
  4. Как добавить батник в автозагрузку Windows 10-2

Это добавит командный файл в автозагрузку текущего пользователя. Если необходимо, чтобы скрипт выполнялся при входе в систему всех пользователей, скопируйте его в системную папку C:ProgramDataMicrosoftWindowsStart MenuProgramsStartup.

Способ 2: «Редактор реестра»

Добавить батник в автозагрузку можно также путем применения несложного твика реестра, прописав во встроенном «Редакторе реестра» путь к командному файлу.

  1. Запустите «Редактор реестра» командой regedit, выполненной в диалоговом окошке Win + R.
  2. Как добавить батник в автозагрузку Windows 10-3

  3. Разверните ветку HKEY_CURRENT_USERSOFTWAREMicrosoftWindowsCurrentVersionRun или HKEY_LOCAL_MACHINESOFTWAREMicrosoftWindowsCurrentVersionRun, если хотите, чтобы добавленный в автозапуск батник запускался для всех пользователей.
  4. Создайте в правой колонке новый строковый параметр с именем файла BAT или произвольным названием.
  5. Как добавить батник в автозагрузку Windows 10-4

  6. Откройте двойным кликом по созданному параметру окошко редактирования его значения и вставьте в поле «Значение» полный путь к BAT-файлу. Если в пути присутствуют пробелы, заключите путь в двойные прямые кавычки.
  7. Как добавить батник в автозагрузку Windows 10-5

Скопировать полный путь к файлу можно в его «Свойствах» либо из его контекстного меню, вызванного с зажатой клавишей Shift.

Способ 3: Планировщик заданий

Следующий метод добавления командного файла в автозагрузку Windows 10 заключается в создании задачи в системном «Планировщике заданий».

  1. Запустите «Планировщик заданий» командой taskschd.msc, выполненной в диалоговом окошке Win + R.
  2. Как добавить батник в автозагрузку Windows 10-6

  3. Нажмите в правой колонке по «Создать задачу».
  4. Как добавить батник в автозагрузку Windows 10-7

  5. В окне мастера создания задачи дайте новому заданию произвольное имя, активируйте, если нужно, запуск скрипта с наивысшими правами.
  6. Как добавить батник в автозагрузку Windows 10-8

  7. Перейдите на вкладку «Триггеры» и нажмите кнопку «Создать».
  8. Как добавить батник в автозагрузку Windows 10-9

  9. В выпадающем списке «Начать задачу» выберите «При запуске» или «При входе в систему». Нажмите «OK».
  10. Как добавить батник в автозагрузку Windows 10-10

  11. Перейдите на вкладку «Действия» и нажмите «Создать».
  12. Как добавить батник в автозагрузку Windows 10-11

    Lumpics.ru

  13. Нажав кнопку «Обзор», выберите добавляемый в автозапуск файл BAT. Остальные настройки можно не менять, убедитесь только, что в качестве действия выбран «Запуск программы» и последовательно сохраните настройки.
  14. Как добавить батник в автозагрузку Windows 10-12

Созданная задача появится в разделе «Библиотека планировщика заданий». При желании ее можно будет испытать, выделив мышкой и нажав ссылку «Выполнить» в правой колонке «Планировщика заданий».
Как добавить батник в автозагрузку Windows 10-13

Способ 4: Локальные групповые политики

Этот способ добавления батника в автозагрузку подходит только для Windows 10 редакции Pro и выше.

  1. Запустите «Редактор локальных групповых политик» командой gpedit.msc через диалоговое окошко «Выполнить» (Win + R).
  2. Как добавить батник в автозагрузку Windows 10-14

  3. Разверните ветку «Конфигурация пользователя»«Административные шаблоны»«Система»«Вход в систему» и откройте двойным кликом настройки политики «Выполнять эти программы при входе в систему».
  4. Как добавить батник в автозагрузку Windows 10-15

  5. Активируйте радиокнопку «Включено» и нажмите кнопку «Показать».
  6. Как добавить батник в автозагрузку Windows 10-16

  7. В поле «Значение» открывшегося диалогового окошка вставьте полный путь к файлу-батнику, нажмите «OK» и сохраните настройки.
  8. Как добавить батник в автозагрузку Windows 10-17

Если необходимо, чтобы батник запускался при входе в систему всех пользователей, нужно изменить одноименную политику в разделе «Конфигурация компьютера», а не «Конфигурация пользователя».

Еще статьи по данной теме:

Помогла ли Вам статья?

Windows 10 run batch file
(Image credit: Future)

On Windows 10, a batch file typically has a «.bat» extension, and it is a special text file that contains one or multiple commands that run in sequence to perform various actions with Command Prompt.

Although you can type commands manually to execute a particular task or change system settings on Windows 10, a batch file simplifies the work of having to re-type the commands, saving you time and avoiding mistakes.

You can also use other tools like PowerShell to write even more advanced scripts. However, running batch files in Command Prompt is still relevant for executing commands to change settings, automate routines, and launch apps or web pages on your computer.

This guide will walk you through the steps to create and run a batch file on Windows 10. Also, we will outline the steps to create advanced scripts and rum them automatically on schedule using the Task Scheduler.

How to create a batch file on Windows 10

The process of writing a batch file is not complicated. You only need Notepad or another text editor and some basic knowledge of typing commands in Command Prompt. These instructions will help you create a basic and advanced batch file to query system settings.

Create basic Windows 10 batch file

To create a basic batch file on Windows 10, use these steps:

  1. Open Start.
  2. Search for Notepad and click the top result to open the text editor.
  3. Type the following lines in the text file to create a batch file: 

@ECHO OFF

ECHO Hello World! Your first batch file was printed on the screen successfully. 

PAUSE

The above script outputs the phrase, «Hello World! Your first batch file was printed on the screen successfully,» on the screen.

  • @ECHO OFF — Shows the message on a clean line disabling the display prompt. Usually, this line goes at the beginning of the file. (You can use the command without the «@» symbol, but it’s recommended to include it to show a cleaner return.)
  • ECHO — The command prints the text after the space on the screen.
  • PAUSE — Allows the window to stay open after the command has been executed. Otherwise, the window will close automatically as soon as the script finishes executing. You can use this command at the end of the script or after a specific command when running multiple tasks and wanting to pause between each line.

Windows 10 basic batch file

(Image credit: Future)
  1. Click the File menu.
  2. Select the Save as option.
  3. Confirm a name for the script — for example, first_basic_batch.bat.
  • Quick note: While batch files typically use the .bat file extensions, you can also find them using the .cmd or .btm file extensions.

Once you complete the steps, double-click the file to run it. Alternatively, you can use the steps below to learn how to run a batch file with Command Prompt, File Explorer, or Task Scheduler.

Create advanced Windows 10 batch file

To create an advanced Windows batch file with multiple commands, use these steps:

  1. Open Start.
  2. Search for Notepad and click the top result to open the text editor.
  3. Type the following lines in the text file to create a more advanced Windows 10 batch file:

@ECHO OFF 

:: This batch file details Windows 10, hardware, and networking configuration.

TITLE My System Info

ECHO Please wait… Checking system information.

:: Section 1: Windows 10 information

ECHO ==========================

ECHO WINDOWS INFO

ECHO ============================

systeminfo | findstr /c:»OS Name»

systeminfo | findstr /c:»OS Version»

systeminfo | findstr /c:»System Type»

:: Section 2: Hardware information.

ECHO ============================

ECHO HARDWARE INFO

ECHO ============================

systeminfo | findstr /c:»Total Physical Memory»

wmic cpu get name

wmic diskdrive get name,model,size

wmic path win32_videocontroller get name

wmic path win32_VideoController get CurrentHorizontalResolution,CurrentVerticalResolution

:: Section 3: Networking information.

ECHO ============================

ECHO NETWORK INFO

ECHO ============================

ipconfig | findstr IPv4ipconfig | findstr IPv6

START https://support.microsoft.com/en-us/windows/windows-10-system-requirements-6d4e9a79-66bf-7950-467c-795cf0386715

PAUSE

The above script runs each line to query a series of system details, and the result will be divided into three categories, including «WINDOWS INFO,» «HARDWARE INFO,» and «NETWORK INFO.» Also, the «START» command will open the web browser in the official support page outlining the Windows 10 system requirements, which you can check against your information.

  • @ECHO OFF — Shows the message on a clean line disabling the display prompt. Usually, this line goes at the beginning of the file.
  • TITLE — Prints a custom name in the title bar of the console window.
  • :: — Allows writing comments and documentation information. These details are ignored when the system runs the batch file.
  • ECHO — Prints the text after the space on the screen.
  • START — Opens an app or website with the default web browser.
  • PAUSE — Tells the console window to stay open after running the command. If you do not use this option, the window will close automatically as soon as the script finishes executing.

Advanced script sample

(Image credit: Future)
  1. Click the File menu.
  2. Select the Save as option.
  3. Type a name for the script — for example, first_advanced_batch.bat.

After you complete the steps, double-click the .bat file to run it or use the steps below to execute the script with Command Prompt, File Explorer, or Task Scheduler.

Create actionable Windows 10 batch file

You can also write batch scripts for any task that does not require user interaction. For instance, to map a network drive, install an application, change system settings, and more.

To create a non-interactive batch file on Windows 10, use these steps:

  1. Open Start.
  2. Search for Notepad and click the top result to open the text editor.
  3. Type the following command to map a network drive in the text file: net use z: \PATH-NETWORK-SHAREFOLDER-NAME /user:YOUR-USERNAME YOUR-PASSWORD

In the command, replace the «\PATH-NETWORK-SHAREFOLDER-NAME» for the folder network path to mount on the device and «YOUR-USERNAME YOUR-PASSWORD» with the username and password that authenticates access to the network share. 

This example maps a network folder as a drive inside File Explorer using the «Z» drive letter: net use z: \10.1.4.174ShareFiles

  • Quick note: If you are accessing the files from another computer that uses a specific username and password, do not forget to use the /user: option with the correct credentials.

Map network drive script

(Image credit: Future)
  1. Click the File menu.
  2. Select the Save as option.
  3. Confirm a name for the script — for example, mount-z-network-drive.bat.

Once you complete the steps, the batch file will map the network folder without opening a Command Prompt window.

We only demonstrate a script with a single command, but you can include as many as you like, as long as you write them one per line.

How to run a batch file on Windows 10

Windows 10 has at least three ways to write batch files. You can run them on-demand using Command Prompt or File Explorer. You can configure the script using the Task Scheduler app to run it on schedule. Or you can save the batch files in the «Startup» folder to let the system run them as soon as you sign into the account.

Run batch file on-demand

If you want to run a script on-demand, you can use File Explorer or Command Prompt.

Command Prompt

To run a script file with Command Prompt on Windows 10, use these steps:

  1. Open Start.
  2. Search for Command Prompt, right-click the top result, and select the Run as administrator option.
  3. Type the following command to run a Windows 10 batch file and press Enter: C:PATHTOFOLDERBATCH-NAME.bat

In the command, make sure to specify the path and name of the script. 

This example runs the batch file located in the «scripts» folder inside the «Downloads» folder: C:UsersUserAccountDownloadsfirst_basic_batch.bat

Run batch file from Command Prompt

(Image credit: Future)

After you complete the steps, the console will return the results, and the window won’t close even if the script does not include the «PAUSE» command since you are invoking the script from within a console session that was already open.

File Explorer

To run a batch file with File Explorer, use these steps:

  1. Open File Explorer.
  2. Browse to the folder with the batch file.
  3. Double-click the script file to run it.
  4. (Optional) If a command in the batch file requires administrator privileges, you will have to run the script as an admin by right-clicking the file and selecting the Run as administrator option.

File Explorer run batch file as administrator

(Image credit: Future)
  1. Click the Yes button

Once you complete the steps, the script will run each command in sequence, displaying the results in the console window.

Run batch files on startup

Windows 10 also features a known folder called «Startup,» which the system checks every time it starts to run applications, shortcuts, and scripts automatically without the need for extra configuration.

To run a script on the Windows 10 startup, use these steps:

  1. Open File Explorer.
  2. Open the folder containing the batch file.
  3. Right-click the batch file and select the Copy option.
  4. Use the Windows key + R keyboard shortcut to open the Run command.
  5. Type the following command: shell:startup

Run shell startup command

(Image credit: Future)
  1. Click the OK button.
  2. Click the Paste option from the «Home» tab in the Startup folder. (Or click the Paste shortcut button to create a shortcut to the batch file.)

Configure script on startup folder

(Image credit: Future)

After you complete the steps, the batch file will execute automatically every time you log into your account.

Run batch file with Task Scheduler

To use Task Scheduler to run the batch file automatically at a specific time, use these steps:

  1. Open Start.
  2. Search for Task Scheduler and click the top result to open the app.
  3. Right-click the «Task Scheduler Library» branch and select the New Folder option.
  4. Confirm a name for the folder — for example, MyScripts.
  • Quick note: You don’t need to create a folder, but keeping the system and your tasks separate is recommended.
  1. Click the OK button.
  2. Expand the «Task Scheduler Library» branch.
  3. Right-click the MyScripts folder.
  4. Select the Create Basic Task option.

Task Scheduler create basic task

(Image credit: Future)
  1. In the «Name» field, confirm a name for the task — for example, SystemInfoBatch.
  2. (Optional) In the «Description» field, write a description for the task.
  3. Click the Next button.
  4. Select the Monthly option.
  • Quick note: Task Scheduler lets you choose from different triggers, including a specific date, during startup, or when a user logs in to the computer. In this example, we will select the option to run a task every month, but you may need to configure additional parameters depending on your selection.

Task trigger settings

(Image credit: Future)
  1. Click the Next button.
  2. Use the «Start» settings to confirm the day and time to run the task.
  3. Use the «Monthly» drop-down menu to pick the months of the year to run the task.

Task Scheduler date selection

(Image credit: Future)
  1. Use the «Days» or «On» drop-down menu to confirm the days to run the task.

Schedule batch file day of the month

(Image credit: Future)
  1. Click the Next button.
  2. Select the Start a program option to run the batch file.

Start a program action

(Image credit: Future)
  1. In the «Program/script» field, click the Browse button.
  2. Select the batch file you want to execute.

Task Scheduler batch file location

(Image credit: Future)
  1. Click the Finish button.

Once you complete the steps, the task will run the script during the configured time and date or action.

The above instructions are meant to schedule only a basic task. You can use these instructions to create a more customizable task with the Task Scheduler.

This guide focuses on Windows 10, but the same steps will also work for older versions, including Windows 8.1 and 7. Also, you can refer to these instructions if you have Windows 11 installed on your computer.

More Windows resources

For more helpful articles, coverage, and answers to common questions about Windows 10 and Windows 11, visit the following resources:

  • Windows 11 on Windows Central — All you need to know
  • Windows 10 on Windows Central — All you need to know

Get the best of Windows Central in in your inbox, every day!

Mauro Huculak is technical writer for WindowsCentral.com. His primary focus is to write comprehensive how-tos to help users get the most out of Windows 10 and its many related technologies. He has an IT background with professional certifications from Microsoft, Cisco, and CompTIA, and he’s a recognized member of the Microsoft MVP community.

How do I run a bat file at startup in Windows 2008?

asked Nov 16, 2009 at 22:11

BrokeMyLeg's user avatar

Windows Scheduler — When my computer starts

I’m pretty sure you can the built-in Windows Scheduler to execute your batch file on startup.

Try this:

Start > Programs > Accessories > System Tools > Scheduled Tasks

Select the location of your batch file and on the next page select «When my computer starts».

You may also want to move it to somewhere OTHER than the startup folder to avoid «weirdness».

Good luck!

answered Nov 16, 2009 at 22:31

KPWINC's user avatar

KPWINCKPWINC

11.3k3 gold badges36 silver badges44 bronze badges

1

In previous versions and I am going to assume still in Windows 2008 you can set a scheduled task to be run «when the computer starts» instead of at a specific time.

Update:
Just checked a test Windows 2008 machine of mine.

Run Task Scheduler from the start menu search box.
Choose Create Basic Task on the right.
On the trigger selection, you will have choices for «When the computer starts» and «When I log on»

answered Nov 16, 2009 at 22:32

ManiacZX's user avatar

ManiacZXManiacZX

1,64613 silver badges16 bronze badges

Place the batch file into the ‘Startup’ folder for the user. Or do you want to run it before the user signs in?

answered Nov 16, 2009 at 22:18

The Woo's user avatar

The WooThe Woo

5696 gold badges20 silver badges39 bronze badges

Fire up an mmc, add it local computer policy settings snap-in and in Windows settings/Scripts put your startup script.

answered Nov 17, 2009 at 9:14

Maxwell's user avatar

MaxwellMaxwell

5,0461 gold badge25 silver badges31 bronze badges

Run a batch file at loading of Windows 8 and 10 and windows server 2016.

  1. Create a shortcut to the batch file.
  2. Once the shortcut is created, ‘right-click’ the shortcut file and select Cut.
  3. Press Start on the keyboard, type Run, and press Enter.
  4. In the Run window, type shell:startup to open the Startup folder.
  5. Once the Startup folder is opened, click the Home tab at the top of the folder. Then, select Paste to paste the shortcut file into the Startup folder.

I hope is useful.

answered Sep 7, 2020 at 15:44

AminRostami's user avatar

When using Windows PC, you probably have used, come across or heard of a batch file. However, not many people can clearly tell what a batch file is, its use, or how it is run in Windows. This article will help you to understand batch files, why they are used, and how to use them.

Related: What is drivers in Windows 10 and how to troubleshoot drivers?

Simply
put, a batch file is a special type of plain text file containing a multiple or
a list of commands for the command line interpreter (cmd) to run.  Batch files use .bat file extension and are
only useful in Windows OS. In some instances, batch files are referred to as
script files. The Windows command prompt can understand and execute batch file
commands in a sequence to perform a given task.

Why
Use Batch Files?

In Windows 10, you may use a batch file to perform various actions including loading programs, automate repetitive tasks, and change system settings among others. While you can perform these actions or input the commands every time you need to run them, a batch file saves you time and energy by automating the process. Besides, with a batch file, you can execute a bunch of processes without user intervention. Users may run a batch files to:

  • Launch
    programs or run processes at startup.
  • Schedule
    tasks such as file backups.
  • Configure
    devices.
  • Automate
    routines.
  • Launch
    apps or websites.

Caution: Though batch files are very helpful, they can be used to
perform malicious actions. Attackers can use batch files to execute commands
that would harm your PC. Therefore, before you run a batch file, ensure that
you know and trust the source.

Creating a Batch
File

To
create a batch file in Windows, you only need a plain text editor and cmd
commands.

  • Open “Notepad” or any other text editor such as Notepad ++ and type your commands.
  • You may type commands to perform multiple tasks in a single file.
Batch File Example
Batch File Example
  • Click the “File” menu, then save and type the name of the batch file by adding .bat at the end of the name.
  • Click the “Save” button. You can identify the .bat file with a thumbnail with two gear icons.
Sample Batch File
Sample Batch File

How to Run Batch
File in Windows 10?

You
can use various methods on Windows 10 to run a batch file depending on how and
when you want to execute the tasks.

Method
1: Run Batch File on Demand

You
can run the file from file explorer or Windows Command Prompt to perform the
tasks only when you need to.

From
File Explorer

  • In File Explorer, open the folder containing the batch file.
  • Double click the file or right-click to run the file as an administrator if the task requires admin permission to execute.
Run Batch File Manually
Run Batch File Manually

From
Windows Command Prompt

  • Launch Command Prompt with the “Run as Admin” option.
  • Change the directory to the folder containing your batch file “C:[user][file location path]”
  • Then type the command the name of the file with or without the .bat extension and press Enter.
Start File
Start File

Method
2: How to Run Batch File During Startup?

If
you want to execute the batch file whenever you sign in to Windows, you can do
so with the following steps.

  • Press the “Win + R” shortcut keys to open the Run utility. Type “shell: startup” and hit Enter on your keyboard.
Run Shell
Run Shell
  • This will open the “Startup” folder.
  • Copy and paste your batch file or its shortcut into this folder and then close.
Startup Method
Startup Method
  • You can sign out your account and sign in again to verify that it works.

Method
3: Run Batch File With Task Scheduler

If
you want to execute the task at a later time, you can use the Windows 10 Task
Scheduler to run the batch file.

  • Go to the Start menu and search for “Task Scheduler” and select the appropriate option from the result.
  • Under the scheduler library on the left panel, create a folder for your task and click “Create Basic Task…” under the “Actions” section on the right-side panel.
  • Enter the name and description (optional) of your task on the resulting wizard and then click “Next”.
Create Task
Create Task
  • Set the task trigger depending on when you need the task to run and click the “Next” button.
Schedule Trigger
Schedule Trigger
  • Under “Action” choose the “Start a program” option and continue to the next page.
  • In the “Script” field, click “Browse”, navigate to the location where you save the batch file and choose the file.
Choose Action
Choose Action
  • Verify the task details and click “Finish” to complete the process.
Finish to Complete
Finish to Complete
  • Windows will automatically run the batch file at your specified time.

Conclusion

Batch
files stores instructions to perform a specific task in Windows. You can use a
batch file to automate routines, configure system settings and many other basic
tasks. You can create and save a batch file and use any of the above methods to
execute the file in Windows 10. The only major limitation is that batch files
are exclusive to Windows PC.

In this guide we will show you how to enable programs or custom scripts to run when Windows boots up. You may prefer that your Outlook opens up every time you log in to your computer in the morning at work, or you may want a custom batch file to run every time the desktop loads. Whatever your needs, this guide will show several convenient ways for configuring this behavior. We will also take a look at other methods programs use to run at boot and how to disable them.

Task Scheduler

In recent versions of Windows, we geeks no longer have to configure a hack or workaround to make a program run at boot, because can use the Task Scheduler utility provided in Windows. It’s best to use this method when at all possible, because this utility was specifically made for this purpose. Task Scheduler gives you a variety of options, such as whether or not to run the application with escalated privileges and setting the application to run only when certain conditions are met (AC power, network connection, etc).

To show you an example of what you can do with Task Scheduler, we will go through the steps required to make Event Viewer open up when you log in.

Go to the Start menu, type “Task Scheduler” and select it from the search results.

Task Scheduler can also be accessed in the Control Panel under Administrative Tools.

In the right side of the Task Scheduler menu, under Actions, select “Create Task.”

After clicking on that, you will see the following menu:

In the screenshot above, we have already put in a name and description for the task we’re creating. The only other thing we have done is check the box “Run with highest privileges.” Launching certain applications such as Event Viewer will typically result in a User Account Control prompt, unless you have UAC disabled on your system. When scheduling a task that requires administrator privileges, be sure to check this box, otherwise you will see an error in the notification area (lower right corner of the taskbar) and have to manually allow it.

Once you have filled out a name and description, click the “Triggers” tab, and then click “New.” You will be presented with a menu like the one below.

In this menu, under “Begin the task:” select “At log on.” Choose which user you would like the task to run for at log on, and configure any of the applicable advanced settings you would like. With the settings in the above screenshot, Event Viewer will run at every future log on as soon as user ‘geek’ logs in.

After you are finished configuring the new trigger, click OK and then select the “Actions” tab. Click “New” to make a new action.

Choose “Start a program” under the Action menu and then click “Browse” to point the new task to the program you would like it to start. In the example above, we have selected Event Viewer. If there are any arguments you need to run with your program, you can add those as well. For Event Viewer, none will be required, but other programs such as gaming servers will rely on them.

Click OK to exit out of the Actions menu. The “Conditions” and “Settings” tabs can be left alone, but feel free to check them out for a few more options – most of which are irrelevant for a task that runs a program at log on.

Click OK on the Create Task menu, and you are finished.

Startup Folder

Another way to set a program or script to run at log on is using the Startup folder. You can access this folder in Windows 7 and previous versions of Windows by going to Start > All programs > Startup. On Windows 8 and previous versions, Startup can also be accessed in Explorer by browsing to “C:UsersusernameAppDataRoamingMicrosoftWindowsStart MenuProgramsStartup” (replacing ‘username’ with the name of your user).

To use the Startup folder to configure a program to run at boot, just make a shortcut to said program (Right click > Send to > Desktop) and put that shortcut in the Startup folder. Some programs use this method as their way of configuring themselves to run at start. If you have a program that keeps launching whenever you log in, there may be a shortcut to that program in the Startup folder.

Running Custom Scripts at Startup

Along with running programs at log on, you can also use Task Scheduler or the Startup folder to run custom batch scripts. Batch files contain commands that would normally be run in a command-line window. For example, the following code tells Windows to map a network share located on 192.168.1.1 to drive Z:.

net use z: \192.168.1.1share /USER:geek /P:Yes

To execute this line of code at startup, simply paste it into a text document and save the file as .bat. Place the .bat file in the Startup folder or use Task Scheduler to have your computer execute the line(s) of code whenever the specified user logs in.

Disabling programs from running at boot

There are a few ways that a program can configure itself to run at boot. The methods mentioned above are two of them, and after reading that you should have a good idea on how to disable programs that use those two methods. You should also see this guide for help with disabling programs that use the registry or other methods to run at boot.

READ NEXT

  • › How to Open an App or File in a New Virtual Desktop on Windows 10
  • › PSA: You Can Email Books and Documents to Your Kindle
  • › How to Change Your Age on TikTok
  • › How to Screen Record on iPhone
  • › The New HP Pro x360 Fortis Is a 2-In-1 Laptop Under $500
  • › This Huge Curved Ultrawide Monitor From LG Is $337 Today
  • › Get PC Power With Tablet Portability in the Surface Pro 9 for $200 Off

Понравилась статья? Поделить с друзьями:
  • Windows rt surface 64gb планшет характеристики
  • Windows rt surface 32 gb обновить до windows 10
  • Windows route add узнать номер интерфейса
  • Windows root system32 ntoskrnl exe что делать
  • Windows root system32 ntoskrnl exe скачать