MSFN Forum: [Tool] Hide console (command line) windows - MSFN Forum

Jump to content



  • 4 Pages +
  • 1
  • 2
  • 3
  • 4
  • You cannot start a new topic
  • You cannot reply to this topic

[Tool] Hide console (command line) windows run you batch files completely hidden Rate Topic: -----

#41 User is offline   Dobby 

  • Member
  • PipPip
  • Group: Members
  • Posts: 258
  • Joined: 17-May 04

Posted 15 February 2006 - 02:39 PM

YES! Does what it says on the tin. Now I could be using the various utils incorrectly but from my observations this is how they compare:
  • CMDOW /HID - Only hides the windows once it's opened
  • HIDCON - Does a create job of hiding the console window but stop all output completely so you can't log anything
  • RunHiddenConsole - Does exactly what I need. Hides the console (doesn't flash up at all) and also allows output to be piped to a file for later review
@RogueSpear
I don't think that's right with regards to WMI . I wrote some C# apps that use WMI to setup network printers and rename user/computer names and it works fine from cmdlines.txt.


#42 User is offline   Martin H 

  • Friend of MSFN
  • PipPipPipPipPip
  • Group: Members
  • Posts: 802
  • Joined: 24-November 06
  • OS:none specified

Posted 11 August 2007 - 07:03 AM

View Poststoopid, on Aug 11 2007, 02:16 PM, said:

"The utility is attached to the post."

No it isn't. It's only there for people who want to go through the bother of creating yet ANOTHER online account and password.

You really live up to your account name... :rolleyes:

Attachment downloads are available for contributing i.e. registered MSFN forum members.

#43 User is offline   Panarchy 

  • Member
  • PipPip
  • Group: Banned
  • Posts: 115
  • Joined: 17-April 07

Posted 10 November 2007 - 05:57 AM

WOW!

Thanks!

I will use this for my USB distribution!
... now I can add more features!

#44 User is offline   chrisbraines 

  • Newbie
  • Group: Members
  • Posts: 18
  • Joined: 08-June 08

Posted 29 June 2008 - 02:10 PM

View PostDobby, on Feb 15 2006, 09:39 PM, said:

YES! Does what it says on the tin. Now I could be using the various utils incorrectly but from my observations this is how they compare:
  • CMDOW /HID - Only hides the windows once it's opened
  • HIDCON - Does a create job of hiding the console window but stop all output completely so you can't log anything
  • RunHiddenConsole - Does exactly what I need. Hides the console (doesn't flash up at all) and also allows output to be piped to a file for later review
@RogueSpear
I don't think that's right with regards to WMI . I wrote some C# apps that use WMI to setup network printers and rename user/computer names and it works fine from cmdlines.txt.


#45 User is offline   chrisbraines 

  • Newbie
  • Group: Members
  • Posts: 18
  • Joined: 08-June 08

Posted 29 June 2008 - 02:19 PM

View PostDobby, on Feb 15 2006, 09:39 PM, said:

YES! Does what it says on the tin. Now I could be using the various utils incorrectly but from my observations this is how they compare:
  • CMDOW /HID - Only hides the windows once it's opened
  • HIDCON - Does a create job of hiding the console window but stop all output completely so you can't log anything
  • RunHiddenConsole - Does exactly what I need. Hides the console (doesn't flash up at all) and also allows output to be piped to a file for later review
@RogueSpear
I don't think that's right with regards to WMI . I wrote some C# apps that use WMI to setup network printers and rename user/computer names and it works fine from cmdlines.txt.




Hi everyone.I am a complete beginner at these forums so please forgive me for any errors

or admissions.

I am using this command file to silently install a number of applications.But I would like

to hide the Dos window while the programs are being installed.So i am using a small

utilitie to hide the dos window by the name of RunHiddenConsole.exe.But in spite of every

effort on my behalf I cannot get it to work here is my batch file listed below

I have also added the following lines to my WINNT.SIF and CMDLINES.TXT Files but I donot

Think it is necessary to add any entries two these Files.

CMDLINES.TXT ".\System32\RunHiddenConsole.exe"

WINNT.SIF [GuiRunOnce]
"%systemdrive%\System32\RunHiddenConsole.exe"

System32 Folder I have added the RunHiddenConsole.exe File to this Folder under $OEM$ Folder structure
----------------------------------

@echo off
TITLE Windows XP SP3 - Unattended Installation

RunHiddenConsole.exe /W %systemdrive%\Install\install.cmd I am using this line to run the exe file
==============================================

ECHO.
ECHO Installing Adobe Reader 8
ECHO Please wait...
start /wait %systemdrive%\Install\AdbeRdr812_en_US.exe /sPB /rs
ECHO.Done

ECHO.
ECHO Installing Adobe Flash Player
ECHO Please wait...
start /wait %systemdrive%\Install\install_flash_player.exe /s
ECHO.Done

ECHO
ECHO Installing DirectX 9.0c
ECHO Please wait...
start /wait %systemdrive%\Install\directx_9c_redist.exe /t:"%temp%" /q
ECHO.Done

ECHO.
ECHO Installing Google Earth
ECHO Please wait...
start /wait %systemdrive%\Install\GoogleEarthWin.exe /s /a /s /v"/qb"
ECHO.Done

ECHO.
ECHO Installing Nero 6.3 Express
ECHO Please wait...
start /wait %systemdrive%\Install\nero63120.exe /SILENT /NOREBOOT
ECHO.Done

ECHO.
ECHO Installing OO Defrag Professional 8.5
ECHO Please wait...
start /wait %systemdrive%\Install\OODefrag85ProfessionalEnu.exe /s /a /s /v"/qb"
ECHO.Done

ECHO.
ECHO Installing TuneUp Utilities 2007
ECHO Please wait...
start /wait %systemdrive%\Install\TU2007TrialEN.exe /QB
ECHO.Done

ECHO.
ECHO Restarting the PC in 30 seconds...
shutdown.exe -r -f -t 30 -c "Windows XP will now restart in 1 minute, this will give
enough time for the shortcuts to update and for the shell to fully load before it\'s ready to restart!"

EXIT

Iff any of you more advanced programers could give me the syntax for this line I would be very
grateful and any other tips as well.

#46 User is offline   Martin H 

  • Friend of MSFN
  • PipPipPipPipPip
  • Group: Members
  • Posts: 802
  • Joined: 24-November 06
  • OS:none specified

Posted 29 June 2008 - 05:13 PM

If you have defined 'OemPreinstall=Yes' in WINNT.SIF and have RunHiddenConsole.exe located in '\$OEM$\$$\system32\', then add the following in WINNT.SIF under GuiRunOnce :
RunHiddenConsole.exe /W %systemdrive%\Install\install.cmd

Or, you could also just place RunHiddenConsole.exe into '\$OEM$\$1\Install\' and then add the following in WINNT.SIF under GuiRunOnce :
%systemdrive%\Install\RunHiddenConsole.exe /W %systemdrive%\Install\install.cmd

You shouldn't add RunHiddenConsole.exe to either cmdlines.txt or install.cmd...

Personally, i preffer Oleg Scherbakov's hidcon.exe, as it's only 2kb big and supports T-12 installs(cmdlines.txt), which RunHiddenConsole.exe dosen't...

#47 User is offline   chrisbraines 

  • Newbie
  • Group: Members
  • Posts: 18
  • Joined: 08-June 08

Posted 01 July 2008 - 02:57 PM

View PostMartin H, on Jun 30 2008, 12:13 AM, said:

If you have defined 'OemPreinstall=Yes' in WINNT.SIF and have RunHiddenConsole.exe located in '\$OEM$\$$\system32\', then add the following in WINNT.SIF under GuiRunOnce :
RunHiddenConsole.exe /W %systemdrive%\Install\install.cmd

Or, you could also just place RunHiddenConsole.exe into '\$OEM$\$1\Install\' and then add the following in WINNT.SIF under GuiRunOnce :
%systemdrive%\Install\RunHiddenConsole.exe /W %systemdrive%\Install\install.cmd

You shouldn't add RunHiddenConsole.exe to either cmdlines.txt or install.cmd...

Personally, i preffer Oleg Scherbakov's hidcon.exe, as it's only 2kb big and supports T-12 installs(cmdlines.txt), which RunHiddenConsole.exe dosen't...



Fantastic I cannot thank you enough.I have tried both methods and they worked without any
hitches my setup is as follows

OemPreinstal=Yes ---------------- WINNT.SIF File

[GuiRunOnce]
RunHiddenConsole.exe /W %systemdrive%\Install\install.cmd ------------- WINNT.SIF File

RunHiddenConsole.exe Copied to $OEM$\$$\System32 Folder

I have also removed all references to RunHiddenConsole.exe from cmdlines.txt and install.cmd

At the weekend I will have ago at using hidcon.exe to see if i can remove cmdlines.txt window

from appearing at the T12 stage of the windows setup.Would I be correct in assuming that if I add

this line to my GuiRunOnce it will prevent the window from appearing

[GuiRunOnce]
hidcon.exe %systemdrive%\$OEM$\cmdlines.txt

hidcon.exe Copied to $OEM$\$$\System32 Folder

I must give a special thanks to Martin for his clarification on this subject many thanks Chris UK

#48 User is offline   Martin H 

  • Friend of MSFN
  • PipPipPipPipPip
  • Group: Members
  • Posts: 802
  • Joined: 24-November 06
  • OS:none specified

Posted 01 July 2008 - 05:15 PM

You're most welcome, mate :)

Now about your next question...

No, that would not work, since whatever you put under GuiRunOnce will be run at first logon i.e. just before you see the desktop after the install is finished, but the contents of cmdlines.txt will be run at T-12 i.e. 12 minutes before the install is finished...

If you e.g. have a batchfile and a regfile set to be run from cmdlines.txt, then you'll just change it from :

Quote

[COMMANDS]
"useraccounts.cmd"
"regedit /s autologon.reg"

Into :

Quote

[COMMANDS]
"hidcon useraccounts.cmd"
"regedit /s autologon.reg"

And then place hidcon.exe into '$OEM$\', or '$OEM$\$$\system32\' (depends about if you want it permanently in system32 or not...)

Btw, the MSFN 'Unattended Windows' guide is also your friend here :)

#49 User is offline   gunsmokingman 

  • MSFN Master
  • Group: Super Moderator
  • Posts: 2,019
  • Joined: 02-August 03
  • OS:none specified
  • Country: Country Flag

Posted 01 July 2008 - 11:23 PM

Here is a VBS script that accept arguments. I have tested this on XP SP3 only

Here is how I tested the script
1:\ I created a simple %SystemDrive%\Test1.cmd and %SystemDrive%\Test2.cmd
Test1.cmd

Quote

@Echo Off

Dir /a /s /w >ListDir.txt


Test2.cmd

Quote

@Echo Off

Set Error=%SystemDrive%\Error.txt
Set UaLog=%SystemDrive%\UaLog.txt

if exist %SystemDrive%\XPCD Goto Task1

if not exist %SystemDrive%\XPCD Goto Ops1


:Task1

if exist D:\ Goto Task2

if not exist D:\ Goto Ops2


:Task2

Set T=%Time%
Echo Confirm Preparing To Copy XPCD > %UaLog%
Echo Confirm %SystemDrive%\XPCD >> %UaLog%
Echo Confirm D:\ >> %UaLog%
Echo Confirm Copy  >> %UaLog%
Echo Start Time : %T%  >> %UaLog%
xcopy %systemdrive%\XPCD D:\XPCD /S /E /I /F /Y
Set A=%Time%
Echo End Time : %A%  >> %UaLog%
::start %UaLog%
Goto Quit1

:Ops1

Set T=%Time%
Echo Missing %SystemDrive%\XPCD > %Error%
Echo End Time %T%  >> %Error%
::start %Error%
Goto Quit1

:Ops2

Set T=%Time%
Echo Confirm %SystemDrive%\XPCD > %Error%
Echo Missing Z:\ >> %Error%
Echo Cancel Copy  >> %Error%
Echo End Time %T%  >> %Error%
::start %Error%
Goto Quit1

:Quit1

Exit


2:\ I then created a RunOnceEx.cmd

Quote

@Echo Off && CLS && COLOR F9 && MODE 67,17

SET KEY=HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnceEx

REG ADD %KEY% /V TITLE /D "Test Cmd_Hide.vbs" /f
REG ADD %KEY%\000 /VE /D "Run Once Install" /f

REG ADD %KEY%\101 /VE /D "Test Silent Cmd 01" /f
REG ADD %KEY%\101 /V 1 /D "Hide_Cmd.vbs %SystemDrive%\Test1.cmd" /f

REG ADD %KEY%\103 /VE /D "Test Silent Cmd 02" /f
REG ADD %KEY%\103 /V 1 /D "Hide_Cmd.vbs %SystemDrive%\Test2.cmd" /f


3:\ I copy this Vbs Script Hide_Cmd.vbs to %SystemDrive%\Windows\System32
Save As Hide_Cmd.vbs

Quote

Dim Obj, Col
Dim Act : Set Act = CreateObject("Wscript.Shell")
Dim Fso : Set Fso = CreateObject("Scripting.FileSystemObject")
If Wscript.Arguments.Count = 0 Then
 Wscript.Echo vbCrLf &  "Please Drag And Drop A File Or Folder On This Script"
Else
 For Each Obj In WScript.Arguments
  If Right(InStr(Obj,".cmd"),4) Then 
   Act.Run("cmd.exe /C " & Chr(34) & Obj & Chr(34)),0,True
  End If 
 Next 
End If


This is only for cmd promt scripts
4:\ I then ran the RunOnceEx.cmd and the Test1.cmd and Test2.cmd then ran without
showing or flashing the cmd promt window.
This is the vbs script I used to test the RunOnceEx.cmd
Save As Run.vbs

Quote

CreateObject("Wscript.Shell").Run("rundll32.exe iernonce.dll,RunOnceExProcess"),1,True


Here is a Image Of RunOnce Silent while the xcopy is active.

#50 User is offline   chrisbraines 

  • Newbie
  • Group: Members
  • Posts: 18
  • Joined: 08-June 08

Posted 02 July 2008 - 02:01 PM

View PostMartin H, on Jul 2 2008, 12:15 AM, said:

You're most welcome, mate :)

Now about your next question...

No, that would not work, since whatever you put under GuiRunOnce will be run at first logon i.e. just before you see the desktop after the install is finished, but the contents of cmdlines.txt will be run at T-12 i.e. 12 minutes before the install is finished...

If you e.g. have a batchfile and a regfile set to be run from cmdlines.txt, then you'll just change it from :

Quote

[COMMANDS]
"useraccounts.cmd"
"regedit /s autologon.reg"

Into :

Quote

[COMMANDS]
"hidcon useraccounts.cmd"
"regedit /s autologon.reg"

And then place hidcon.exe into '$OEM$\', or '$OEM$\$$\system32\' (depends about if you want it permanently in system32 or not...)

Btw, the MSFN 'Unattended Windows' guide is also your friend here :)



This is absolutely fabulous stuff i don't no what to say.Yes I am using both of these files to cerate
a user account.I have these files in my $OEM$ folder as well as cmdlines.txt

cmdlines.txt --------------------- $OEM$ Folder
useracounts.cmd --------------- $OEM$ Folder
autologon.reg ------------------- $OEM$ Folder

Here is my cmdlines.txt as it is at the moment
"useraccounts.cmd"
".\Install\install.cmd"

And i will change it to this to make use of hidcon.exe

"hidcon useraccounts.cmd"
".\Install\install.cmd"

I think it is best to place hidcon.exe into $OEM$\$1\Install folder as this folder and it's contents
can be easily deleted after the install is over.The same goes for RunHiddenConsole.exe.Many
thanks Chris UK

#51 User is offline   Martin H 

  • Friend of MSFN
  • PipPipPipPipPip
  • Group: Members
  • Posts: 802
  • Joined: 24-November 06
  • OS:none specified

Posted 02 July 2008 - 09:13 PM

View Postchrisbraines, on Jul 2 2008, 10:01 PM, said:

And i will change it to this to make use of hidcon.exe

"hidcon useraccounts.cmd"
".\Install\install.cmd"


The first line is correct, if hidcon.exe is either in $OEM$\ or $OEM$\$$\system32\.

The second line is not correct, however... you need to put hidcon in front of all cmd files(but not reg files). Also, that line would only work if you had install.cmd in $OEM$\Install\ as .\ means current folder i.e. $OEM$(as that's where cmdlines.txt is run from)...

Also, remember to delete install.cmd from GuiRunOnce, since you have now changed your mind about where to run it from...

If you want to run install.cmd from cmdlines.txt instead of GuiRunOnce, then you need to keep in mind that environment variables isn't supported from cmdlines.txt, so to run install.cmd from $OEM$\$1\Install\, and if you also have hidcon.exe in that folder, then this is the line to use : ".\$1\Install\hidcon .\$1\Install\install.cmd"

This post has been edited by Martin H: 02 July 2008 - 09:14 PM


#52 User is offline   COKEDUDEUSF 

  • Member
  • PipPip
  • Group: Members
  • Posts: 226
  • Joined: 24-January 07

Posted 18 August 2008 - 06:44 PM

Thx a lot for this.

#53 User is offline   sweept 

  • Junior
  • Pip
  • Group: Members
  • Posts: 55
  • Joined: 08-November 05

Posted 17 December 2008 - 05:35 AM

how about a tool that will not only hide but will allow showing the console as in making it reappear by specific choice to be used from inside the batch

#54 User is offline   an3k 

  • Junior
  • Pip
  • Group: Members
  • Posts: 93
  • Joined: 15-June 08
  • OS:Windows 7 x64
  • Country: Country Flag

Posted 17 December 2008 - 09:23 AM

Does this tool already hides windows at T-12 of an unattended cd? in the first post faq the auther wrote that the answer is no and that he is aware of that. still true? Thanks :)

#55 User is offline   strel 

  • segmentation fault
  • PipPipPipPip
  • Group: Members
  • Posts: 629
  • Joined: 24-February 08
  • OS:XP Pro x86
  • Country: Country Flag

Posted 17 December 2008 - 03:52 PM

See this.

#56 User is offline   Martin H 

  • Friend of MSFN
  • PipPipPipPipPip
  • Group: Members
  • Posts: 802
  • Joined: 24-November 06
  • OS:none specified

Posted 17 December 2008 - 05:30 PM

View Postan3k, on Dec 17 2008, 04:23 PM, said:

Does this tool already hides windows at T-12 of an unattended cd? in the first post faq the auther wrote that the answer is no and that he is aware of that. still true? Thanks :)

As you correctly stated, then RunHiddenConsole.exe(or hidec.exe, which it was later renamed to), dosen't support hiding the console at T-12...

However, hidcon.exe(which the above poster also linked to) is another tool which does, and is only 2kb...

#57 User is offline   Martin H 

  • Friend of MSFN
  • PipPipPipPipPip
  • Group: Members
  • Posts: 802
  • Joined: 24-November 06
  • OS:none specified

Posted 24 December 2008 - 07:54 PM

Personally, then i would just do the following to hide batch-files/command-line tools:

hide.inf:
[Version]
Signature="$Windows NT$"

[DefaultInstall]
RunPostSetupCommands=Hide.RunPostSetupCommands:1

[Hide.RunPostSetupCommands]
batch.cmd

Then to run hide.inf:
rundll32 advpack.dll,LaunchINFSection hide.inf

(No need to specify 'DefaultInstall' in the above command-line, since it's implied when no other section is called...)

Also, when i'm allready typing here, then here's an inf that will make a desktop shortcut and a Quick Launch-shortcut for '%programfiles%\Regshot unicode\Regshot.exe', and then you guys can just change it to whatever yourself...

shortcut.inf:
[Version]
Signature="$Windows NT$"

[DefaultInstall]
UpdateInis=Shortcut.UpdateInis

[Shortcut.UpdateInis]
setup.ini,progman.groups,,"group1=""%16409%"""
setup.ini,group1,,"""Regshot unicode"",""""""%16422%\Regshot unicode\Regshot.exe""""""
setup.ini,progman.groups,,"group2=""%16410%\Microsoft\Internet Explorer\Quick Launch"""
setup.ini,group2,,"""Regshot unicode"",""""""%16422%\Regshot unicode\Regshot.exe""""""

Then to run shortcut.inf:
rundll32 advpack.dll,LaunchINFSection test.inf,,1

(The last ',,1' is for specifying to run the 'DefaultInstall' section, and to hide the prompt that normally shortly flashes when making shortcuts through inf's...)

This post has been edited by Martin H: 25 December 2008 - 04:47 PM


#58 User is offline   premier4ever 

  • Newbie
  • Group: Members
  • Posts: 25
  • Joined: 16-March 08

Posted 17 June 2009 - 02:13 PM

View PostRogueSpear, on Jul 11 2005, 02:26 PM, said:

VAD, on Jul 11 2005, 12:04 AM, said:

@RogueSpear
I tested the utility at T-12 tonight. The cmdlines.txt was
[Commands]
"hidec.exe useraccounts.cmd"
"hidec.exe choice.cmd"

Both batch files have executed; however, I saw the blinking windows. It's different from your results... Odd. Anyway, it doesn't work from cmdilens.txt at the moment.
<{POST_SNAPBACK}>


I'm running a VBscript from cmdlines.txt which necessitates "cscript" before the script name. It could very well be that executing the following from a command prompt would work
RunnHiddenConsole.exe "cscript vbscript.vbs"

But since every line within cmdlines.txt needs to be inside quotes to begin with I'm not sure you could get it to work. Does cmdlines.txt support nesting of quotes? I seriously don't have the time to test the theory out at the moment. Especially since I'm using a solution that works. Might not be as pretty, but it's working.



Hi all :)

I'm experimenting the use of SVCPACK.ini instead of using CMDLINES.txt as follows:

1- Deleted the cmdow @ /HID entries from the USERACCOUNTS.cmd and RunOnceEx.cmd files.

2- Deleted the CMDLines.txt and moved the USERACCOUNTS.cmd and RunOnceEx.cmd from the $OEM$ to lets say %CDROM%\Apps Folder.

3- Added the RunHiddenConsole.exe to the SVCPACK folder in %CDROM%\I386.

4- Added the lines ( RunHiddenConsole.exe /W %CDROM%\Apps\USERACCOUNTS.cmd ) and ( RunHiddenConsole.exe /W %CDROM%\Apps\RunOnceEx.cmd ) to the [SetupHotfixesToRun] in the Svcpack.ini which is located in %CDROM%\I386.

Hope this will work :)

Unfortunately i couldnt come up with a way to run the cleanup.cmd, my cleanup file makes my system reboot in a 60sec after runonceex finishes installing the apps. fearing that it might reboot the system before windows installation finishes.

Any suggestions are welcomed

#59 User is offline   Martin H 

  • Friend of MSFN
  • PipPipPipPipPip
  • Group: Members
  • Posts: 802
  • Joined: 24-November 06
  • OS:none specified

Posted 18 June 2009 - 06:37 AM

Why don't you just run cleanup.cmd from runonceex.cmd? This is also showned in the unattended guide...

#60 User is offline   rynoinstereo 

  • Group: Members
  • Posts: 1
  • Joined: 09-July 09

Posted 09 July 2009 - 10:29 PM

Just wanted to say a HUGE thank you for this great little tool! I love it when things just work.

Share this topic:


  • 4 Pages +
  • 1
  • 2
  • 3
  • 4
  • You cannot start a new topic
  • You cannot reply to this topic

2 User(s) are reading this topic
0 members, 2 guests, 0 anonymous users



All trademarks mentioned on this page are the property of their respective owners
Copyright © 2001 - 2011 msfn.org
Privacy Policy