Tubatools.AutoStart
1.0.2
dotnet add package Tubatools.AutoStart --version 1.0.2
NuGet\Install-Package Tubatools.AutoStart -Version 1.0.2
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Tubatools.AutoStart" Version="1.0.2" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Tubatools.AutoStart" Version="1.0.2" />
<PackageReference Include="Tubatools.AutoStart" />
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Tubatools.AutoStart --version 1.0.2
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: Tubatools.AutoStart, 1.0.2"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Tubatools.AutoStart@1.0.2
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Tubatools.AutoStart&version=1.0.2
#tool nuget:?package=Tubatools.AutoStart&version=1.0.2
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
开机自启(Tubatools.AutoStart)
在「设置 → 工具和系统集成」里加一张开关卡片:打开后,登录 Windows 时自动启动图吧工具箱。
- 便携版:以管理员权限启动,不再弹 UAC。
- 商店(MSIX)版:以当前用户身份启动,不提权(Windows 不允许包应用以管理员身份自动运行)。
实现方式
便携版(非打包)
- 使用当前用户的登录计划任务
TubaWinUi3AutoStart,运行级别为「最高权限」(HighestAvailable)。 - 任务动作直接指向当前工具箱的 exe,工作目录设为 exe 所在目录;随工具箱移动后,下次启动会自动修复任务里的路径。
- 关闭开关会删除该计划任务;不会动启动文件夹里的其他项目。
- 不用
HKCU\...\Run的原因:Run 键只能以普通用户令牌启动,而便携版需要管理员权限,重新提权会在每次登录弹 UAC。
商店版(MSIX)
- 使用宿主清单声明的 Windows 启动任务(
uap5:Extension Category="windows.startupTask",TaskId="TubaWinUi3AutoStart")。 - 插件通过
Windows.ApplicationModel.StartupTask.GetAsync读取状态,RequestEnableAsync()开启、Disable()关闭;系统按用户持久化,登录后以当前用户身份激活应用,不弹 UAC。 - 不使用
HKCU\...\Run:打包应用写该键会被注册表虚拟化吞掉,应用内自读为开启、真实系统却没有启动项(已实测)。 - 也不使用计划任务:非管理员进程执行
schtasks /create连/RL LIMITED都返回Access is denied,打包版无法用计划任务实现任何自启,更不能提权。 - 宿主包必须声明这个启动任务(
Package.appxmanifest、run-msix.ps1的 dev 清单、build-msix-store.ps1的 store 清单三处都已加)。换到没有该声明的旧宿主时,插件会显示「宿主没有声明开机启动任务」,而不是假装成功。 - Windows 会在「任务管理器 → 启动应用」里列出「图吧工具箱CE」。如果用户在那里手动禁用,状态为关闭并提示去任务管理器重新启用;组策略禁用则显示错误。
状态与持久化
- 开关会记住用户的选择(宿主设置键
Tubatools.AutoStart.Desired)。插件更新、停用后重新启用时,会按这个选择自动恢复启动任务;不会因为热替换而悄悄丢掉开机自启。 - 便携版状态以真实计划任务为准:不存在 = 关闭;存在且指向当前 exe、当前用户、最高权限、有登录触发 = 开启;存在但配置不匹配 = 待修复。
- 商店版状态以
StartupTask.State为准:Enabled/EnabledByPolicy= 开启;Disabled= 关闭;DisabledByUser= 关闭(附任务管理器启用提示);DisabledByPolicy= 错误。 - 当前进程不是管理员时(极少数没有自动提权的便携版),首次开启会弹一次 UAC 授权;商店版不需要 UAC。
停用 / 卸载
停用、卸载或热替换本插件时,插件会删除自己创建的 TubaWinUi3AutoStart 计划任务(便携版)或禁用 TubaWinUi3AutoStart 启动任务(商店版),避免留下看不见的开机自启。应用正常退出不会删除;用户的选择保存在宿主设置里,重新启用插件后会按它恢复。
验证清单
- 设置页「工具和系统集成」出现「开机自启」/「开机自启(管理员权限)」开关,状态与真实任务一致。
- 便携版:打开开关 → 任务计划程序库根目录出现
TubaWinUi3AutoStart,触发器为「登录时」,运行级别为「最高权限」。 - 便携版:注销/重启后,工具箱以管理员身份自动启动。
- 商店版:打开开关 → 任务管理器「启动应用」里「图吧工具箱CE」为已启用;注销/重启后以普通权限自动启动,不弹 UAC。
- 关闭开关 → 对应计划任务被删除 / StartupTask 被禁用。
- 卸载插件 → 对应计划任务被删除 / StartupTask 被禁用。
There are no supported framework assets in this package.
Learn more about Target Frameworks and .NET Standard.
This package has no dependencies.
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.