An IT technician is updating a Windows legacy Batch script (.bat) designed to map network drives and log workstation startup details. The script needs to reference the system-defined variable containing the computer name of the domain controller that authenticated the user session. Which of the following represents the correct construct and syntax to retrieve this value within the Batch file?
- %LOGONSERVER%Cevap
- B$env:LOGONSERVER
- C$LOGONSERVER
- D"LOGONSERVER"
Cevap
The construct %LOGONSERVER% is the correct syntax for referencing the authenticating domain controller environment variable within a Windows Batch (.bat) script.
In standard Windows Batch (.bat) scripts, environment variables are dereferenced by enclosing the variable name in percent signs (%LOGONSERVER%). The LOGONSERVER environment variable holds the name of the domain controller that authenticated the active logon session.
Adım Adım Çözüm
Anahtar Kavram
Windows Batch Environment Variable Syntax