HelloZeroNet / HelloZeroNet/ZeroNet
Use Task Scheduler To Run Silently On Windows Login (No Lame CMD Flash)
- 主要语言
- JavaScript
- 星标
- 18.8k
- 派生
- 2.3k
- PR 合并指标
- 30 天内没有已合并 PR
描述
Hey,
Currently, if user chooses:
> Start ZeroNet when Windows starts
It copies a modified version of zeronet.cmd to:
> %AppData%\Microsoft\Windows\Start Menu\Programs\Startup
That's ugly, as an ugly cmd window flashes every time. Yuck!
How about instead use the Windows Task Scheduler.
Example XML file that can be imported into the Windows Task Scheduler:
```
2016-03-03T23:56:38.0983188
Will
ZeroNet
Will
InteractiveToken
LeastPrivilege
IgnoreNew
true
true
true
false
false
true
false
true
true
true
false
false
false
false
PT0S
7
K:\zeronet\Python\python.exe
zeronet.py
```
Just an example.
The paths under exec need to be set to correct path. Same with "Author" and "UserId".
Should be easy enough to script.
You can then run the task silently via a .vbs file:
```
On Error Resume Next
Set fso = CreateObject("Scripting.FileSystemObject")
Set WshNetwork = CreateObject("WScript.Network")
Set WshShell = WScript.CreateObject("WScript.Shell")
'0 Hides Window
wshshell.run "%WinDir%\System32\schtasks.exe /run /tn ""ZeroNet""", 0, true
Set wshshell = Nothing
```
Instead of saving the .vbs file to the user's startup folder; I recommend saving to the user's run registry key via:
> REG ADD HKCU\Software\Microsoft\Windows\CurrentVersion\Run /v ZeroNet /t REG_SZ /d "\"K:\zeronet\zeronet.vbs"\" /f
Again, just an example. Assumes above vbs script is at "K:\zeronet\zeronet.vbs".
For anyone who wants to use this now:
> 1.) Just modify the windows task like I mentioned and import it.
>
> 2.) Then create the above .vbs file and save it somewhere to your choosing. Edit to use correct path.
>
> 3.) Then edit the above REG add command with correct path to .vbs file to make the .vbs file (thus ZeroNet) run on startup. That's it. Too easy, right!
Thanks,
Will
贡献指南
这个仓库没有索引到贡献指南
调研方向
Locate the Windows startup logic around zeronet.cmd and zeronet.py; first trace how the “Start ZeroNet when Windows starts” option writes to the Startup folder. Done means the option uses Task Scheduler or its silent launcher so ZeroNet starts at login without a visible CMD window, with user-specific paths handled correctly.
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- python, shell
- 领域
- devops, operating-systems
- Issue 类型
- 功能
- 难度
- 5/5
- 预计耗时
- 一周以上
- 活跃度
- 停滞
- 描述清晰度
- 基本清楚
- 新手友好度
- 25/100