Dear all Sifu,
Anyone know how to do a batch script got filter the hostname ?
like in my environment my workstation name
"KL-Petronas-Marketing-001"
"JB-TowerB-Sales-001"
"A-PN-Support-001"
The Hostname Format is "Location-Building-Department-PC"
But using Hyphen to separate which value
I just want the
"KL-Petronas"
"JB-TowerB"
"A-PN"
Thank you.. deeply appreciate.
Hostname batch script.
Moderator: DosItHelp
Re: Hostname batch script.
'
Code: Select all
@echo off
set $var=KL-Petronas-Marketing-001
for /f "tokens=1,2 delims=-" %%a in ( "%$var%" ) do echo.token=%%a-%%b_
pause
exit /b