(第一次海报。) 我对编码有些陌生,并且需要编写一些脚本来放置在GPO中。我有要保存到任务栏的快捷方式。 (%appdata%\ Microsoft \ Internet Explorer \ Quick Launch \ User Pinned \ TaskBar *。*)问题是我们域中同时拥有Windows 7和Windows 10。所有快捷方式都可以在execpt Windows资源管理器中使用。如何在Windows版本中创建脚本并相应地应用快捷方式?基本上像这样:
If version Windows 10 > Copy items in windows 10 shortcuts
or else
If version Windows 7 > Copy items in windows 7 shortcuts
谢谢!
Windows 7 Bat文件:
del "%appdata%\Microsoft\Internet Explorer\Quick Launch\User Pinned\TaskBar\*.*" /q
xcopy "\\servername\path\GPOScripts\Shortcuts\Windows 7\*.*" /e /v /y "%appdata%\Microsoft\Internet Explorer\Quick Launch\User Pinned\TaskBar" /s /i
regedit.exe /s \\servername\path\GPOScripts\Windows10Settings\PinnedItems.reg
reg add HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\HideDesktopIcons\NewStartPanel /v {20D04FE0-3AEA-1069-A2D8-08002B30309D} /t REG_DWORD /d 0 /f
reg add HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\HideDesktopIcons\ClassicStartMenu /v {20D04FE0-3AEA-1069-A2D8-08002B30309D} /t REG_DWORD /d 0 /f
reg add HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer /v EnableAutoTray /t REG_DWORD /d 0 /f
Windows 10:
del "%appdata%\Microsoft\Internet Explorer\Quick Launch\User Pinned\TaskBar\*.*" /q
xcopy "\\servername\path\GPOScripts\Shortcuts\Windows 10\*.*" /e /v /y "%appdata%\Microsoft\Internet Explorer\Quick Launch\User Pinned\TaskBar" /s /i
regedit.exe /s \\servername\path\GPOScripts\Windows10Settings\PinnedItems.reg
reg add HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\HideDesktopIcons\NewStartPanel /v {20D04FE0-3AEA-1069-A2D8-08002B30309D} /t REG_DWORD /d 0 /f
reg add HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\HideDesktopIcons\ClassicStartMenu /v {20D04FE0-3AEA-1069-A2D8-08002B30309D} /t REG_DWORD /d 0 /f
reg add HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer /v EnableAutoTray /t REG_DWORD /d 0 /f
更新:
我决定采用Powershell路线并执行以下操作:(有效)
SVersion = (get-itemproperty -Path "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion" -Name ProductName).ProductName
if($OSVersion -eq "Windows 10 Pro")
{
Remove-Item "%appdata%\Microsoft\Internet Explorer\Quick Launch\User Pinned\TaskBar\*.*"
Copy-item "\\server\Shortcuts\Windows 10\*.*" -Destination "%appdata%\Microsoft\Internet Explorer\Quick Launch\User Pinned\TaskBar" -Recurse
}
ElseIf($OSVersion -eq "Windows 7 Pro")
{
Remove-Item "%appdata%\Microsoft\Internet Explorer\Quick Launch\User Pinned\TaskBar\*.*"
Copy-item "\\server\Shortcuts\Windows 7\*.*" -Destination "%appdata%\Microsoft\Internet Explorer\Quick Launch\User Pinned\TaskBar" -Recurse