Click the Save button.<\/li>\n<\/ul>\nNote:<\/strong> if the file is not saved to the specified location, for example, to drive C, with the message “You do not have permission to save files in this location”, save it to the Documents folder or desktop, and then copy to the desired location (the cause of the problem is that Windows 10 requires administrator rights to write to some folders, and since the notepad was not started as an administrator, it cannot save the file to the specified folder.)<\/p>\nYour .bat file is ready:<\/strong> if you run it, all the commands listed in the file will be automatically executed (if there are no errors and you have administrator rights: in some cases, you may need to run the bat file as administrator: right click on the .bat file – run as administrator in the context menu).<\/p>\nIn the future, if you want to edit the created file, just right click on it and select “Edit”.<\/p>\n
There are other ways to make a bat file, but they all boil down to writing one command per line into a text file in any text editor (without formatting), which is then saved with a .bat extension (for example, in Windows XP and 32-bit Windows 7 you can even create a .bat file on the command line using the text editor edit).<\/p>\n
If you have enabled the display of file extensions (it changes in the control panel – Explorer options – view – hide extensions of registered file types), you can simply create a .txt file, then rename the file by installing the .bat extension.<\/p>\n
Running programs in the bat file and other basic commands<\/span><\/h2>\nMost often, the following tasks occur: launching a program or several programs from a .bat file, launching a function (for example, clearing the clipboard, distributing Wi-Fi from the laptop, turning off the computer by the timer).<\/p>\n
<\/p>\n
To run the program or programs, use the command:<\/p>\n
start “” path_to_program<\/p><\/blockquote>\n
If the path contains spaces, take the entire path in double quotes, for example:<\/p>\n
start “” “C:\\Program Files\\program.exe”<\/p><\/blockquote>\n
After the path to the program, you can also specify the parameters with which it should be run, for example (similarly, if the startup parameters contain spaces, take them in quotation marks):<\/p>\n
start “” c:\\windows\\notepad.exe file.txt<\/p><\/blockquote>\n
In double quotes, after start, the specification must specify the name of the batch file displayed in the command line header. This is an optional parameter, but in the absence of these quotes, executing bat files containing quotes in paths and parameters can go in unexpected ways.<\/p>\n
Another useful feature is the launch of another bat file from the current file. You can do it using the call command:<\/p>\n
call path_to_file_bat options<\/p><\/blockquote>\n
The passed parameters at startup can be read inside another bat file, for example, we call a file with parameters:<\/p>\n
call file2.bat parameter1 parameter2 parameter3<\/p><\/blockquote>\n
In file2.bat, you can read these parameters and use them as paths, parameters for launching other programs in this way:<\/p>\n
echo% 1<\/p>\n
echo% 2<\/p>\n
echo% 3<\/p>\n
pause<\/p><\/blockquote>\n
For each parameter we use its serial number with a percent sign. The result in the above example will output all the passed parameters to the command window (the echo command is used to output text to the console window).<\/p>\n
By default, the command window closes immediately after all commands are executed. If you need to read the information in the window, use the pause command – it will stop executing the commands (or closing the window) before pressing any key in the console from the user’s side.<\/p>\n
Sometimes, before executing the next command, you need to wait a while (for example, before the first program is fully launched). To do this, you can use the command:<\/p>\n
timeout\/t time_in_seconds<\/p><\/blockquote>\n
If desired, you can run the program in minimized or expanded video with the MIN and MAX parameters before specifying the program itself, for example:<\/p>\n
start “”\/MIN c:\\windows\\notepad.exe<\/p><\/blockquote>\n
To close the command window after all the commands have been executed (although, usually it is already closed when using start to start), use the exit command in the last line. If the console still does not close after starting the program, try using this command:<\/p>\n
cmd\/c start\/b”” path_to_program parameters<\/p><\/blockquote>\n
In this command, if the paths to the program or parameters contain spaces, there may be problems with the launch, which can be solved as follows:<\/p>\n
cmd\/c start “”\/d “path_to_space_folder”\/b program_file_name “parameter_space_blocks”<\/p><\/blockquote>\n","protected":false},"excerpt":{"rendered":"
Often the tips for various actions and fixes in Windows 10, 8 and Windows 7 include steps like: “create a .bat file with the following content and run it.” However, a novice user doesn\u2019t always know how to do this and what a file .bat is. This manual details how to create a bat command […]<\/p>\n","protected":false},"author":105,"featured_media":25320,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","enabled":false}}},"categories":[1821,25],"tags":[24678,24677,24673,24674,24676,24671,24672,24675],"jetpack_publicize_connections":[],"yoast_head":"\n
How to Create and Run Batch (BAT) File<\/title>\n \n \n \n \n \n \n \n \n \n \n \n \n \n\t \n\t \n\t \n \n \n \n \n \n\t \n\t \n\t \n