Disclaimer: This article is a blogger original article, follow the CC 4.0 BY-SA copyright agreement, reproduced, please attach the original source link and this statement.
OFF @echo
echo current letter:% D0 ~
echo the currently logged in user:% username%
echo the current drive letter and path:% ~ dp0
short file name format echo the current drive letter and path:% ~ sdp0
echo the full path of the current batch : ~% F0
echo CMD current default directory:% cd%
echo the computer name:% ComputerName%
PAUSE
@echo off
set id=%USERNAME%
echo %id%
pause
@echo off
set n=%computername%
set Nname=%n:~3,-3%
echo %Nname%
pause