@ECHO OFF
REM Stores computername, user ID and Workgroup in environment
REM variables COMPUTERNAME, USERNAME and WORKGROUP in Windows
REM Uses WINSET, which must be located somewhere in the PATH.

NET CONFIG | FIND /I "COMPUTERNAAM" > %TEMP%.\NETCONF$.BAT
ECHO > COMPUTERNAAM.BAT WINSET COMPUTERNAME=%%1
CALL %TEMP%.\NETCONF$.BAT
DEL COMPUTERNAAM.BAT

NET CONFIG | FIND /I "GEBRUIKERSNAAM" > %TEMP%.\NETCONF$.BAT
ECHO > GEBRUIKERSNAAM.BAT WINSET USERNAME=%%1
CALL %TEMP%.\NETCONF$.BAT
DEL GEBRUIKERSNAAM.BAT

NET CONFIG | FIND /I "WERKGROEP" > %TEMP%.\NETCONF$.BAT
ECHO > WERKGROEP.BAT WINSET WORKGROUP=%%1
CALL %TEMP%.\NETCONF$.BAT
DEL WERKGROEP.BAT

DEL %TEMP%.\NETCONF$.BAT
Published in: Batch
Download

Related snippets