how to run bat file in cmd code example
Example 1: run batch file from cmd
Command Prompt
To run a batch file with Command Prompt, use these steps.
Open Start.
Search for Command Prompt, right-click the top result, and select the Run as administrator option.
Type the path and name of the batch file, and press Enter:
C:\PATH\TO\FOLDER\BATCH-NAME.bat
Example 2: windows how to execute bat file
go to the file location:
>cd file_location
write file name + extension:
>file.cmd
Example 3: what is a windows batch file
@ECHO OFF
ECHO Congratulations! Your first batch file executed successfully.
PAUSE
Example 4: batch file extension
@echo off
setlocal
set file=C:\Users\l72rugschiri\Desktop\fs.cfg
for %%i IN ("%file%") do (
echo filedrive=%%~di
echo filepath=%%~pi
echo filename=%%~ni
echo fileextension=%%~xi
)