如何啓動使用powershell啓動特殊文件夾?像「ThisPC」,iexplorer如何啓動無目標啓動特殊文件夾
這將釘啓動exe的罰款,但怎麼樣的Windows資源管理器和myComputer?如何固定這些物品,因爲他們沒有目標?
鑑於這種
<start:DesktopApplicationTile Size="2x2" Column="0" Row="0" DesktopApplicationLinkPath="%APPDATA%\Microsoft\Windows\Start Menu\Programs\Windows System\This PC.lnk" />
這似乎與.LNK對「這臺電腦」,「資源管理器」的問題,等等
Function PinLnk
{
Param
(
[Parameter(Mandatory,Position=0)]
[Alias('p')]
[String[]]$Path
)
$Shell = New-Object -ComObject Shell.Application
$Desktop = $Shell.NameSpace(0X0)
$WshShell = New-Object -comObject WScript.Shell
$Flag=0
Foreach($itemPath in $Path)
{
$itemName = Split-Path -Path $itemPath -Leaf
#pin application to windows Start menu
$ItemLnk = $Desktop.ParseName($itemPath)
$ItemVerbs = $ItemLnk.Verbs()
Foreach($ItemVerb in $ItemVerbs)
{
If($ItemVerb.Name.Replace("&","") -match "Pin to Start")
{
$ItemVerb.DoIt()
$Flag=1
}
}
}
}
PinLnk "C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\devenv.exe"
我試過這種方法,以及還沒有牽制MYCOMPUTER開始
PS C:\WINDOWS\system32> Function PinLnk14
>> {
>>
>> $shell = new-object -com Shell.Application
>> $folder = $shell.NameSpace("shell:::{20D04FE0-3AEA-1069-A2D8-08002B30309D}") # ssfDRIVES
>> $ItemVerbs=$folder.Self.Verbs()
>> Foreach($ItemVerb in $ItemVerbs)
>> {
>> Write-Output $ItemVerb.Name
>> If($ItemVerb.Name.Replace("&","") -match "Pin to Start")
>> {
>> Write-Output "TRYING TO PIN"
>> $ItemVerb.DoIt()
>> }
>> }
>> }
PS C:\WINDOWS\system32>
PS C:\WINDOWS\system32> Pinlnk14
&Open
Pin to Quick access
Mana&ge
&Pin to Start
TRYING TO PIN
Map &network drive...
Dis&connect network drive...
Create &shortcut
&Delete
Rena&me
P&roperties
快捷方式我讀了一次,通過GUID訪問這些特殊文件夾:請參閱https://msdn.microsoft.com/en-us/library/windows/desktop/dd378457(v=vs.85).aspx –
*「這將固定到啓動exe的罰款「* ...這正是'我的電腦'(資源管理器)和Internet Explorer(iexplore.exe)是什麼。你想做什麼__exactly__不起作用? – gravity
@gravity如果給我SomePath \ ThisPC.lnk。我如何找到這個路徑的目標來賦予上面的函數? – nlstack01