HelloZeroNet / HelloZeroNet/ZeroNet
Use Task Scheduler To Run Silently On Windows Login (No Lame CMD Flash)
- Ngôn ngữ chính
- JavaScript
- Star
- 18.8k
- Fork
- 2.3k
- Chỉ số merge pull request
- Không có pull request nào được merge trong 30 ngày
Mô tả
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
Hướng dẫn đóng góp
Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này
Đánh giá
Issue này chưa được đánh giá.