how to run a bat file in cmd code example
Example 1: windows how to execute bat file
go to the file location:
>cd file_location
write file name + extension:
>file.cmd
Example 2: what is a windows batch file
@ECHO OFF
ECHO Congratulations! Your first batch file executed successfully.
PAUSE
Example 3: 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
)