我如何使用powershell来调用SHGetKnownFolderPath?(How can I use powershell to call SHGetKnownFolderPath?)

编程入门 行业动态 更新时间:2024-10-13 10:25:36
如何使用powershell来调用SHGetKnownFolderPath?(How can I use powershell to call SHGetKnownFolderPath?)

我是Windows PowerShell的总noob。 我如何使用psl来调用SHGetKnownFolderPath? 如果我不喜欢Get调用返回的某些值,我还想调用SHSetKnownFolderPath。

I'm a total noob on windows powershell. How can I use psl to call SHGetKnownFolderPath ? I want to then also call SHSetKnownFolderPath if I dont like some of the values back from Get call.

最满意答案

您可以使用P / Invoke。 Lee Holmes 在这里有一个如何从PowerShell中完成这个任务的例子。 这里有一个如何使用SHGetKnownFolderPoath的例子。

或者,您可能只能使用Environment.GetFolderPath :

PS> [Environment]::GetFolderPath('CommonApplicationData') C:\ProgramData

您可以通过以下方式获取可用选项的列表:

PS> [Enum]::GetNames([Environment+SpecialFolder])

You can use P/Invoke. Lee Holmes has an example of how to do this from PowerShell here. There's an example of how to use SHGetKnownFolderPoath here.

Alternatively, you might just be able to use Environment.GetFolderPath:

PS> [Environment]::GetFolderPath('CommonApplicationData') C:\ProgramData

You can get the list of available options by the following:

PS> [Enum]::GetNames([Environment+SpecialFolder])

更多推荐

本文发布于:2023-04-29 03:28:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1334473.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:如何使用   powershell   call   SHGetKnownFolderPath

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!