Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- rem clear the variable before we begin the test
- SET WKNAME=
- CLS
- REM this command will retrieve the value of a registry key from a target:
- reg query \\127.0.0.1\HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\ComputerName\ComputerName
- PAUSE
- CLS
- REM this command will retrieve the value of a registry key and then filter it to make it one line with three values
- reg query \\127.0.0.1\HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\ComputerName\ComputerName | FIND "REG_SZ"
- PAUSE
- CLS
- REM this command SHOULD retrieve the value of a registry key, filter it to make it one line with three values
- REM THEN it should retrieve the third value and put it into the variable "WKNAME"
- FOR /F "tokens=3 delims= " %%A IN ('reg query \\127.0.0.1\HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\ComputerName\ComputerName ^|FIND "REG_SZ"') DO SET WKNAME=%%A
- ECHO REG Name is: %WKNAME%
- PAUSE
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement