문제

Is there a way to use either KNOWNFOLDERID or CSIDL in PowerShell?

I need to be able to access some "known folders" via PowerShell script on a variety of systems. The problem is that those folders' names tend to differ between languages and Environmental Variables list (e.g. $env:something) does not contain folders I am interested accessing in (e.g. C:\Users).

도움이 되었습니까?

해결책

Use the .NET method System.Environment.GetFolderPath like so:

[Environment]::GetFolderPath([Environment+SpecialFolder]::ApplicationData)

The MSDN topic on the Environment.SpecialFolder enum shows all the possible special folders you can ask for.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top