From our Blog

Showing posts with label BATCH. Show all posts
Showing posts with label BATCH. Show all posts

How to run a batch file at a specific time

Run a batch file at a specific time in Windows 8 and 10



Click Start
Type Task and then click Task Scheduler
Once the Task Scheduler is open, you can create a custom task by clicking Create Basic Task. This action starts a wizard that walks you through the process, prompting you with what program you want to execute, as well as how often and what time it should be run.
Run a batch file at a specific time in Windows Vista and 7

Starting with Windows Vista, Microsoft has included the Task Scheduler, a software program designed to run any program, including batch files, at any time or any schedule you desire. To run Task Scheduler, follow the steps below.
Click Start
Type Task and then click Task Scheduler
or
Click Start
Click All Programs
Click Accessories > System Tools > Task Scheduler
Once the Task Scheduler is open, you can create your own custom task by clicking Create Basic Task. This action starts a wizard that walks you through the process, prompting you with what program you want to execute, as well as how often and what time it should be run.
Run a batch file at a specific time in Windows XP and earlier

With Windows 98 and up to Windows XP, Microsoft has included Scheduled Tasks, a software program designed to run any program, including batch files, at any time or any schedule you desire. To run Scheduled Tasks, follow the steps below.
Click Start
Click Programs
Click Accessories > System Tools > Scheduled Tasks
Once open, you can create a custom task by clicking Add Scheduled Task to start the wizard. The wizard will ask you what program you want to execute, how often you want to it to run, and when.

running batch file

To run a batch file, follow the steps below for where you want to run the batch file.
Running a batch file from within Windows
Run a batch file from the Command Prompt

Running a batch file from within Windows

A batch file runs like any other executable file by double-clicking the file within Windows. However, because a batch file runs in a command line, it immediately exits when done, so you may only see a black box for a second.
Tip: If the batch file is closing too fast, or you want to read the output from the batch file, you can edit the batch file and add a pause to the end of the file. The pause command waits for user input before continuing.

Run a batch file from the Command Prompt

To run a batch file, move to the directory containing the file and type the name of the batch file. For example, if the batch file is named "hope.bat", you can type "hope" to execute the batch file.

Editing a batch file

Edit a batch file from within Windows

Batch files are plain-text files
, which means they can be edited as a text file by right-clicking on the file and clicking Edit as shown in the picture.
Once you've clicked edit, your default text editor opens the file and allows it to be modified.
You can also open any text editor or word processor and from within that program open the batch file.
After making all changes save and exit the file. If you are asked how to save the file, make sure it is saved with a .bat file extension.
Tip: See our what commands are available in a batch file page for commands that can be added to a batch file.
Edit a bat file in a Command Prompt (DOS)

To edit a batch file in MS-DOS, follow the steps below.
Note: New versions of Windows or computers running a 64-bit version of Windows no longer support the edit command, which means these steps no longer work. Use the above steps if you are running the latest version of Windows.
Open an MS-DOS command window or load MS-DOS.
In the MS-DOS prompt, type: edit test.bat and press enter.
If typed correctly, you should now see a blue edit screen. Within the screen, type:
@echo off
echo Hello this a test batch file
pause
dir c:\windows
pause

After entering these lines, click File and choose exit; when prompted to save, click Yes. Users who do not have a mouse can accomplish this same task by pressing Alt+F to access the file menu, and then X to exit. Press Enter to save changes.
Once you are back at the MS-DOS prompt, type: test and press Enter to execute the test.bat file.
Tip: If you want to add more lines to this batch file, type edit test.bat to open the file for editing.
Additional information about the MS-DOS edit command is in our edit command page. Some versions of MS-DOS and bootable diskettes may not have the edit command. If this the case, you would either need to obtain the edit.com file or use the copy con command.
Tip: See our what commands are available in a batch file page for commands that can be added to a batch file.

Creating a batch file in Microsoft Windows

Creating a batch file in Microsoft Windows

In Windows, you can create a batch file using the steps below or the steps mentioned in the MS-DOS command line section. If you are more comfortable with Microsoft Windows, you can use any text editor (such as Notepad or WordPad) to create your batch files; as long as the file extension ends with .bat. In the example below, we use the Windows Notepad to create a batch file.
Click Start.
Type: Notepad in the Run box and press Enter.
Once Notepad is open, type the following lines or copy and paste them.
@echo off
echo Hello this a test batch file
pause
dir c:\windows
pause

Click File and then Save, and then navigate to where you want to save the file. For the file name, type "test.bat", and if your version of Windows has a "Save as type" option, choose "All files", otherwise it saves as a text file. Once you have completed these steps, click the Save button and exit notepad.
To run the batch file, double-click it like any other program. Once the batch file has completed running it closes automatically.
Tip: See our what commands are available in a batch file page for commands that can be added to a batch file.
Creating a batch file in MS-DOS

To create a batch file in MS-DOS or the Windows command line, follow the steps below.
Note: New versions of Windows or computers running a 64-bit version of Windows no longer support the edit command, which means these steps no longer work. Use the above steps if you are running the latest version of Windows.
Open an MS-DOS command window or load MS-DOS.
In the MS-DOS prompt, type: edit test.bat and press enter.
If typed correctly, you should now see a blue edit screen. Within the screen, type:
@echo off
echo Hello this a test batch file
pause
dir c:\windows
pause

Once these three lines are entered, click File and choose exit; when prompted to save, click Yes. Users who do not have a mouse can accomplish this same task by pressing Alt+F to access the file menu, and then X to exit. Press Enter to save changes.
Once you are back at the MS-DOS prompt, type: test and press Enter to execute the test.bat file. Because the first line is a pause, you will first be prompted to press a key. Upon doing so, the batch file runs line-by-line; in this case, listing the files in the Windows and Windows\system directories.
Tip: If you want to add more lines to this batch file, type edit test.bat to open the file for editing.
Additional information about the MS-DOS edit command is on our edit command page. Some versions of MS-DOS and bootable diskettes may not have the edit command. If this the case, you would either need to obtain the edit.com file or use the copy con command.
Tip: See our what commands are available in a batch file page for commands that can be added to a batch file.

Information on batch files

Batch files allow MS-DOS and Microsoft Windows users to write a series of commands to run in order upon their execution for automating frequently performed tasks. For example, a batch file could be used to run frequently utilized commands, delete or move a series of files, and other jobs.
One of the earliest batch files was the autoexec.bat, which is a batch file that loaded each time computers with MS-DOS and early versions of Windows started. A simple batch file does not require programming skills and can be done by anyone with an understanding of MS-DOS commands.

CODING

MAINTAINANCE

TRICKS

 
Copyright © 2026 Gebtech Solution