Skip to content
⌘ NSIS Forum Archive

hide taskeng.exe console window

3 posts

kleinstein#

hide taskeng.exe console window

I have made a Visual Basic Script file to start an application
And i registered this VBS to Task Manager through NSIS Script.

The Problem is..
If The Task Manger start this VBS, then i always see the console window.

Is it relevant with NSIS?
if yes, How can i hide this taskeng.exe Console Window??




code for registering to Task Manager:


..
ExpandEnvStrings $0 %COMSPEC%
nsExec::ExecToStack '"$0" /C if 1==1 SchTasks /Create /SC DAILY /ST $SchedulerHour:$SchedulerMin:00 /TN "${GISSCHEDULER_TASK_NAME}" /TR "$InstallDir_Short_scheduler"'
..

VBS contents:


..
..
Set ShellWSH = WScript.CreateObject("WScript.Shell")
MSG_String = """" & InstallDir & "\test\test.exe"" "
Ret = ShellWSH.Run (MSG_String,0,False)
Set ShellWSH = Nothing
..
..
kleinstein#
i have found the solution.

The Cause:

under Registry : HKLM\SOFTWARE\Classes\VBSFile\Shell

you can see the subfolder "Open" with his subfolder "Command".
And you may see another subfolder "Open2" with his subfolder "Command".

If you see the Data Value as "Open" from "HKLM\SOFTWARE\Classes\VBSFile\Shell",
that means any vbs file will start with the "Command" value of "Open".

and ..

If you see the Data Value as "Open2" from "HKLM\SOFTWARE\Classes\VBSFile\Shell",
that means any vbs file will start with the "Command" value of "Open2".

The difference of "Open" and "Open2" of my computer was "Cscript" and "Wscript".

so..

if it is set to use wscript for vbs file, then i do not see any console window.
but if it is set to use cscript for vbs file, then i see always console window.



i hope, this could help to anyone.
Anders#
You should run wscript.exe directly if that is what you want, don't rely on ShellExecute/ExecShell/whatever because like you have seen, you don't know what the default is. Back in the day when vbs viruses were common my default was Notepad!