这是 Skype 应用程序启动信息在注册表中的示例。注册表键名似乎不是标准的;也许您可以从清单中获取键名。UWP 应用程序对管理员来说很不方便。即使 Sysinternals Autoruns 也无法检测到这些应用程序。
$a = Get-AppxPackage *skype* | Get-AppPackageManifest
$a.package.Applications.Application.Extensions.extension.startuptask.taskid
SkypeStartup
$a = get-appxpackage *windowsterminal* | Get-AppxPackageManifest
$a.package.Applications.Application.Extensions.extension.startuptask.taskid
StartTerminalOnLoginTask
$starts = get-appxpackage -pv app | get-appxpackagemanifest | % {
if ($_.package.Applications.Application.Extensions.extension.startuptask.taskid) {
[pscustomobject] @{ PackageFamilyName = $app.PackageFamilyName
TaskID = $_.package.Applications.Application.Extensions.extension.startuptask.taskid} } }
$starts
PackageFamilyName TaskID
----------------- ------
Microsoft.SkypeApp_kzf8qxf38zg5c SkypeStartup
AppleInc.iTunes_nzyj5cx40ttqa {AppleMobileDeviceProcess, iTunesHelper}
Microsoft.WindowsTerminal_8wekyb3d8bbwe StartTerminalOnLoginTask
$starts | % {
$fname = $_.PackageFamilyName
$_.taskid | % {
$taskid = $_
Set-ItemProperty "HKCU:\Software\Classes\Local Settings\Software\Microsoft\Windows\CurrentVersion\AppModel\SystemAppData\$fname\$taskid" State 1 -whatif
}
}
What if: Performing the operation "Set Property" on target "Item: HKEY_CURRENT_USER\Software\Classes\Local Settings\Software\Microsoft\Windows\CurrentVersion\AppModel\SystemAppData\Microsoft.SkypeApp_kzf8qxf38zg5c\SkypeStartup Property: State".
What if: Performing the operation "Set Property" on target "Item: HKEY_CURRENT_USER\Software\Classes\Local Settings\Software\Microsoft\Windows\CurrentVersion\AppModel\SystemAppData\AppleInc.iTunes_nzyj5cx40ttqa\AppleMobileDeviceProcess Property: State".
What if: Performing the operation "Set Property" on target "Item: HKEY_CURRENT_USER\Software\Classes\Local Settings\Software\Microsoft\Windows\CurrentVersion\AppModel\SystemAppData\AppleInc.iTunes_nzyj5cx40ttqa\iTunesHelper Property: State".
What if: Performing the operation "Set Property" on target "Item: HKEY_CURRENT_USER\Software\Classes\Local Settings\Software\Microsoft\Windows\CurrentVersion\AppModel\SystemAppData\Microsoft.WindowsTerminal_8wekyb3d8bbwe\StartTerminalOnLoginTask Property: State".
2 为启用,1 为禁用。在设置应用程序中搜索“启动应用程序”。
Skype:
HKCU\Software\Classes\Local Settings\Software\Microsoft\Windows\CurrentVersion\AppModel\SystemAppData\Microsoft.SkypeApp_kzf8qxf38zg5c\SkypeStartup\State=1(dword)(从 procmon 类别是写入)
Windows 终端:
HKCU\Software\Classes\Local Settings\Software\Microsoft\Windows\CurrentVersion\AppModel\SystemAppData\Microsoft.WindowsTerminal_8wekyb3d8bbwe\StartTerminalOnLoginTask\State=1
iTunes 有 2 个启动任务:
HKCU\Software\Classes\Local Settings\Software\Microsoft\Windows\CurrentVersion\AppModel\SystemAppData\AppleInc.iTunes_nzyj5cx40ttqa\AppleMobileDeviceProcess\State
HKCU\Software\Classes\Local Settings\Software\Microsoft\Windows\CurrentVersion\AppModel\SystemAppData\AppleInc.iTunes_nzyj5cx40ttqa\iTunesHelper\State
也许这个链接有用?
https://learn.microsoft.com/en-us/uwp/api/windows.applicationmodel.startuptask.disable?view=winrt-19041
https://learn.microsoft.com/en-us/uwp/api/windows.applicationmodel.startuptask?view=winrt-19041
[Windows.ApplicationModel.StartupTask]
如果有人告诉我如何使用C#实现,我可以将其翻译成PowerShell。