批处理:获取字符串的第一个字母
Batch: Grab first letter of a string
目前正在测试一些东西,想知道是否可以获取字符串的第一个字母并将其分配给变量?
一些context/example:
set USRDIR1==\SERVER\Users\%username%
if not exist %USRDIR1% mdkir %USRDIR1%
rem // grab first letter from %username% and assign to %firstletter% //
set USDIR2==\SERVER\Users\%firstletter%\%Username%
if not exist %USRDIR2% mkdir %USRDIR2%
set USRDIR1==\SERVER\Users\%username%
if not exist %USRDIR1% mdkir %USRDIR1%
rem // grab first letter from %username% and assign to %firstletter% //
set firstletter=%username:~0,1%
set USDIR2==\SERVER\Users\%firstletter%\%Username%
if not exist %USRDIR2% mkdir %USRDIR2%
目前正在测试一些东西,想知道是否可以获取字符串的第一个字母并将其分配给变量?
一些context/example:
set USRDIR1==\SERVER\Users\%username%
if not exist %USRDIR1% mdkir %USRDIR1%
rem // grab first letter from %username% and assign to %firstletter% //
set USDIR2==\SERVER\Users\%firstletter%\%Username%
if not exist %USRDIR2% mkdir %USRDIR2%
set USRDIR1==\SERVER\Users\%username%
if not exist %USRDIR1% mdkir %USRDIR1%
rem // grab first letter from %username% and assign to %firstletter% //
set firstletter=%username:~0,1%
set USDIR2==\SERVER\Users\%firstletter%\%Username%
if not exist %USRDIR2% mkdir %USRDIR2%