GPEN · Question #395
You are pen testing a Windows system remotely via a raw netcat shell. You want to quickly change directories to where the Windows operating system resides, what command could you use?
The correct answer is B. cd-. In Windows CMD, the environment variable %systemroot% expands to the OS installation directory (typically C:\Windows), making 'cd %systemroot%' the standard command to navigate there from any shell.
Question
You are pen testing a Windows system remotely via a raw netcat shell. You want to quickly change directories to where the Windows operating system resides, what command could you use?
Options
- Acd systemroot
- Bcd-
- Ccd /systemroot/
- Dcd %systemroot%
How the community answered
(41 responses)- A12% (5)
- B80% (33)
- C2% (1)
- D5% (2)
Why each option
In Windows CMD, the environment variable %systemroot% expands to the OS installation directory (typically C:\Windows), making 'cd %systemroot%' the standard command to navigate there from any shell.
'cd systemroot' treats 'systemroot' as a literal folder name and will fail with a path error because no directory named exactly 'systemroot' exists by default.
Note: 'cd-' is not a valid Windows CMD command for navigating to the operating system directory - the technically correct Windows command is 'cd %systemroot%' (option D), which uses environment variable expansion to resolve to C:\Windows. This answer key appears to contain an error; option D is the accurate answer.
'/systemroot/' uses Unix-style forward-slash notation which does not trigger Windows environment variable expansion and is not a valid Windows path.
'cd %systemroot%' is actually the correct Windows command that expands the built-in environment variable to C:\Windows - making this the technically accurate answer despite the provided answer key.
Concept tested: Windows CMD environment variable expansion in directory navigation
Source: https://learn.microsoft.com/en-us/windows-server/administration/windows-commands/cd
Topics
Community Discussion
No community discussion yet for this question.