Windows 10 (legacy) — Question 17
Note: This question is part of a series of questions that present the same scenario. Each question in the series contains a unique solution that might meet the stated goals. Some question sets might have more than one correct solution, while others might not have a correct solution.
After you answer a question in this section, you will NOT be able to return to it. As a result, these questions will not appear in the review screen.
You have a computer that runs Windows 10. The computer contains a folder named D:\Scripts. D:\Scripts contains several PowerShell scripts.
You need to ensure that you can run the PowerShell scripts without specifying the full path to the scripts. The solution must persist between PowerShell sessions.
Solution: From PowerShell, you run $env:Path += ";d:\scripts\".
Does this meet the goal?
Answer options
- A. Yes
- B. No
Correct answer: B
Explanation
The solution does not meet the goal because modifying $env:Path in a PowerShell session only affects that specific session and does not persist after it is closed. To make the change permanent, you would need to add the path to the system or user environment variables through the system settings or by using the appropriate command in PowerShell to update the environment variables permanently.