【发布时间】:2016-06-01 03:12:29
【问题描述】:
当我想将它部署给多个用户时,%Username% 似乎失败了。有一个更好的方法吗?获取指定用户个人资料的方法?:
New-Item -ItemType directory -Path O:\_Backups\Contacts
Robocopy C:\Users\%Username%\Contacts O:\_Backups\Contacts /xo
New-Item -ItemType directory -Path O:\_Backups\Desktop
Robocopy C:\Users\%Username%\Dekstop O:\_Backups\Desktop /xo
New-Item -ItemType directory -Path O:\_Backups\Documents
Robocopy C:\Users\%Username%\Documents O:\_Backups\Documents /xo
New-Item -ItemType directory -Path O:\_Backups\Favorites
Robocopy C:\Users\%Username%\Favorites O:\_Backups\Favorites /xo
New-Item -ItemType directory -Path O:\_Backups\Pictures
Robocopy C:\Users\%Username%\Pictures O:\_Backups\Pictures /xo
【问题讨论】:
-
请edit 描述您提出的问题或您要解决的问题的标题。除了重复您添加的标签中已有的信息之外,您什么也没做。您的主题应该提供足够的信息,以便对在搜索结果中找到它的未来读者有所帮助。在编辑时,您还可以更清楚地说明您的要求。
%USERNAME%将完美地适用于当前登录的用户。如果这就是你想要做的,你没有问题。如果不是,你还没有明确说明你想做什么。
标签: powershell robocopy user-profile