HelloZeroNet / HelloZeroNet/ZeroNet

Use Task Scheduler To Run Silently On Windows Login (No Lame CMD Flash)

オープン
#310 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る
主要言語
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

コントリビューションガイド

このリポジトリのコントリビューションガイドは索引されていません

評価

この issue はまだ評価されていません。

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。