控制特殊文件夹 [英] Controlling Special Folders

查看:62
本文介绍了控制特殊文件夹的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

获取特殊文件夹的值没有问题...

I have no problem getting the value of a Special Folder...

$FullPathToMyDocs =[environment]::GetFolderPath([environment+SpecialFolder]::MyDocuments)

我想做的事情(使用PowerShell)设置这些路径。这可以通过转到用户配置文件目录(Win7 = C:\users \ {username} \ My Documents)手动完成,右键单击文件夹并选择属性,然后编辑"位置"。选项卡条目。

What I'd like to do (using PowerShell) is set these paths. This can be done manually by going to the users profile directory (Win7 = C:\users\{username}\My Documents), right-click a folder and select properties then edit the "Location" tab entries.

我也可以使用unattended.xml文件进行预安装,使用< ProfilesDirectory> d:\ Users< / ProfilesDirectory>,但我宁愿不是。

I could also do this with the unattended.xml file, pre-installation, using <ProfilesDirectory>d:\Users</ProfilesDirectory>, but I'd rather not.

所以,如果我可以通过UI完成,我可以通过PowerShell进行吗?

So if I can do it through the UI, can I do it via PowerShell?

推荐答案

这可以在注册表中完成。
如何使用Profile Maker将用户shell文件夹重定向到指定路径

HKCU \Software \ Microsoft \ Windows \ CurrentVersion \Explorer \ User Shell Folders

HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders

因此可以轻松完成电源外壳

So it can easly be done with power shell

[Microsoft.Win32.Registry]::SetValue("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders", "Desktop", "C:\New Path for desktop")

迈克


这篇关于控制特殊文件夹的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆