HelloZeroNet / HelloZeroNet/ZeroNet

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

Abierto
#310 0 comentarios 0 reacciones 0 asignados Ver en GitHub
Lenguaje dominante
JavaScript
Estrellas
18.8k
Forks
2.3k
Métricas de merge de PR
Sin PR fusionados en 30 d

Descripción

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

Guía de contribución

No hay ninguna guía de contribución indexada para este repositorio

Evaluación

Este issue todavía no se ha evaluado.

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.