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: -----

#21 User is offline   Vadikan 

  • MSFT MVP Windows Expert: Consumers
  • PipPipPip
  • Group: Members
  • Posts: 349
  • Joined: 22-February 04
  • OS:Windows 7 x86
  • Country: Country Flag

Posted 29 June 2005 - 05:26 PM

Thanks for the report, MHz.

I guess the only thing is to test it in cmdlines.txt. I'll do it this week, and post the results.


#22 User is offline   Nema 

  • Group: Members
  • Posts: 1
  • Joined: 07-July 05

Posted 07 July 2005 - 03:03 AM

you can abuse "ping" for wait! :-)

#23 User is offline   RogueSpear 

  • OS: SimplyMEPIS
  • Group: Supreme Sponsor
  • Posts: 1,529
  • Joined: 18-September 04

Posted 07 July 2005 - 07:29 AM

I put the following in my cmdlines.txt

"RunHiddenConsole.exe cscript.exe cmdlines.vbs"


and it didn't seem to run.. On the other hand I've been using this in my cmdlines.txt for months now and it works fine

"cscript.exe cmdlines.vbs"


RunHiddenConsole.exe is already contained with %systemroot%\system32 as I outlined in an earlier post in this thread. I'm trying to put in some debug code to verify all this, but my guess is that it's not running properly.

#24 User is offline   Vadikan 

  • MSFT MVP Windows Expert: Consumers
  • PipPipPip
  • Group: Members
  • Posts: 349
  • Joined: 22-February 04
  • OS:Windows 7 x86
  • Country: Country Flag

Posted 07 July 2005 - 12:47 PM

I can relay the info to the authors. Meanwhile,
runhiddenconsole wscript test.vbs
works, although I didn't test from cmdlines.txt

BTW, do you see any console windows when you run
"cscript.exe cmdlines.vbs"
from cmdilnes.txt?

#25 User is offline   RogueSpear 

  • OS: SimplyMEPIS
  • Group: Supreme Sponsor
  • Posts: 1,529
  • Joined: 18-September 04

Posted 07 July 2005 - 01:03 PM

Unfortunately wscript is unavailable at the time cmdlines is executed. And yes a console window does appear for the brief time the script is executing. In some ways it's I like it though, that way I know it's executing..

#26 User is offline   Vadikan 

  • MSFT MVP Windows Expert: Consumers
  • PipPipPip
  • Group: Members
  • Posts: 349
  • Joined: 22-February 04
  • OS:Windows 7 x86
  • Country: Country Flag

Posted 10 July 2005 - 11:04 PM

@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.

#27 User is offline   war59312 

  • Will's Blog
  • PipPipPipPipPip
  • Group: Members
  • Posts: 922
  • Joined: 07-June 02

Posted 11 July 2005 - 03:05 AM

How about make it display the window when using /? or unavilable command line switchs like /d etc.

Though I wold like to see /d added. ;)

/d

When done from the command line, it is the equivalent to doing a CD /D to that path.

So using the /D switch changes the current drive in addition to changing current
directory for a drive.

Ex.

C:\>

runhiddenconsole /W /d"c:\Program Files\Mail" thunderbird.exe

C:\Program Files\Mail>

waiting for 5 seconds, press a key to continue ...


See it runs thunderbird and changed the directory all in one go. :) So the next time you can just run whatever in that directory without having to sepecify again, so the script runs more efficently. Exspically with hundreds of different directories, etc.

So main it just saves time...

This post has been edited by war59312: 11 July 2005 - 04:25 AM


#28 User is offline   RogueSpear 

  • OS: SimplyMEPIS
  • Group: Supreme Sponsor
  • Posts: 1,529
  • Joined: 18-September 04

Posted 11 July 2005 - 06:26 AM

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.

#29 User is offline   Vadikan 

  • MSFT MVP Windows Expert: Consumers
  • PipPipPip
  • Group: Members
  • Posts: 349
  • Joined: 22-February 04
  • OS:Windows 7 x86
  • Country: Country Flag

Posted 11 July 2005 - 10:13 AM

war59312 said:

How about make it display the window when using /? or unavilable command line switchs like /d etc

If you run the utility w/o parameters, you'll see the usage window.

I don't see the reason for the /d switch, because you can specify any path to the batch file or console app. You don't need to switch the drives. Also, Thnuderbird is not a console app, so what's the point?

@RogueSpear
You got a valid point. Indeed, the quotes in cmdlines.txt cause the problem.

I got another utilitty written by a different person :) Same functionality, but he claims it works from cmdlines.txt. I tested it in Windows, and it works. I'll give it a try from cmdlines.txt tonight.

#30 User is offline   war59312 

  • Will's Blog
  • PipPipPipPipPip
  • Group: Members
  • Posts: 922
  • Joined: 07-June 02

Posted 13 July 2005 - 02:14 AM

lol it was just an example.... well yaah i figured out a better way without having to call it a million times ;)

#31 User is offline   mwgrootwassink 

  • Group: Members
  • Posts: 1
  • Joined: 08-July 05

Posted 18 July 2005 - 06:42 AM

Hi VAD,

I like to integrate this great utility into a application build with Uniface, a 4GL toolbox.
Therefor I need a dll-version of this program.
I that possible? I'm not really into c++ and compiling stuff.
Perhaps you can tell me how I can compile a dll-version

Thanx in advance
Maarten

#32 User is offline   Lostclown 

  • Group: Members
  • Posts: 1
  • Joined: 13-August 05

Posted 13 August 2005 - 07:26 PM

Just wanted to say THANKS for a very nice utility.

Lostclown

#33 User is offline   oioldman 

  • Friend of MSFN
  • PipPipPipPipPip
  • Group: Members
  • Posts: 967
  • Joined: 16-April 04
  • OS:Windows 7 x64

Posted 31 January 2006 - 07:06 AM

i'm just about to try and use this program as it removes the blinking of cmdow.exe. however nobody has mentioned if it works within RunOnceEx.cmd?
If you did could somebody possibly post an example. Im going to try it now and will let you know.

Oldman

#34 User is offline   RogueSpear 

  • OS: SimplyMEPIS
  • Group: Supreme Sponsor
  • Posts: 1,529
  • Joined: 18-September 04

Posted 31 January 2006 - 07:16 AM

I use this utility almost exlusively in my switchless silent installer, most of which run from svcpack.inf, but some I call from RunOnceEx. I think it'll run just about anywhere.

#35 User is offline   oioldman 

  • Friend of MSFN
  • PipPipPipPipPip
  • Group: Members
  • Posts: 967
  • Joined: 16-April 04
  • OS:Windows 7 x64

Posted 01 February 2006 - 11:46 AM

my runonceex is still ongoing, but it works well with cmdlines.txt as demonstrated below and no windows shown
[commands]
"runhiddenconsole.exe /W useraccounts.cmd"
"REGEDIT /S QikLanch.reg"
"REGEDIT /S RegTweaks.reg"
"REGEDIT /S QikLanch.reg"
"runhiddenconsole.exe /W runonceex.cmd"


yes i know qiklanch is there twice, but it works so i leave alone

#36 User is offline   gunsmokingman 

  • MSFN Addict
  • Group: Super Moderator
  • Posts: 1,991
  • Joined: 02-August 03
  • OS:none specified
  • Country: Country Flag

Posted 02 February 2006 - 12:30 AM

You can use a Vbs script to hide a counsil window.
This script make a cmd then the cmd file makes a text file that is ran then it deletes all the files
Save As HideWindowComSpec.vbs

Quote

Const Hide = 0, Norm = 1, Min = 2, Max =3 : Dim Act, CMD1,Fso, Ts, SD, VBS
VBS ="\HideWindowComSpec.vbs" : CMD1 = "\TestHideCmd.Cmd" '''' VARIBLES FOR THE SCRIPT
Set Act = CreateObject("Wscript.Shell") '''' OBJECT FOR THE SCRIPT
Set Fso = CreateObject("Scripting.FileSystemObject") '''' OBJECT FOR THE SCRIPT
Set Ts = Fso.CreateTextFile(SD & CMD1) '''' THIS BUILD THE CMD TO RUN THEN THE CMD BUILDS THE TEXT FILE
SD = Act.ExpandEnvironmentStrings("%Systemdrive%") '''' SET THE SYSTEM DRIVE TO SD
'''' WRITE THE CMD THEN RUNS IT
Ts.WriteLine "@Echo Off" & vbCrLf & "set D=%Date%" & vbCrLf & "Echo The Date : %D% > MyTextTest.txt" &_
"&& Echo User Name : %UserName% >> MyTextTest.txt && Echo Windows Dir : %Windir% >> MyTextTest.txt"
Ts.Close
'''' STARTS THE RUN AND DELETE PHAZE
Act.Run(SD & CMD1),Hide,True '''' RUNS THE CMD HIDDEN
Act.Run("MyTextTest.txt"),Norm,True '''' RUN THE TEXT FILE MADE BY THE CMD
Fso.DeleteFile(SD & CMD1) '''' DELETES THE FILES
Fso.DeleteFile("MyTextTest.txt") '''' DELETES THE FILES
If Fso.FileExists(SD & VBS) Then '''' CHECKS THEN DELETE THIS FILE
Fso.DeleteFile(SD & VBS)
End If

I have made the above script into a SFX file for those who want to try it

This post has been edited by gunsmokingman: 22 February 2006 - 02:41 AM


#37 User is offline   Bilou_Gateux 

  • Powered by Windows Embedded
  • PipPipPipPipPip
  • Group: Members
  • Posts: 766
  • Joined: 03-January 04

Posted 02 February 2006 - 08:58 AM

@gunsmokingman

Is Windows Scripting Host fully installed @T13 svcpack.inf or @T12 cmdlines.txt?
Have you already tried one of your vbs scripts during install (and not @RunOnceEx stage).

although i don't like vbs scripts (only because i have to learn the syntax first to understand what they do :} ) it may help me to run only one specific script which do something like the one above (create a cmd, execute the cmd and delete it w/ hidden console).

This post has been edited by Bilou_Gateux: 02 February 2006 - 08:59 AM


#38 User is offline   RogueSpear 

  • OS: SimplyMEPIS
  • Group: Supreme Sponsor
  • Posts: 1,529
  • Joined: 18-September 04

Posted 02 February 2006 - 09:07 AM

You can execute cscript from cmdlines.txt, but not wscript. Also, WMI is not available yet. So you are a little bit limited in what you can do, but it's not too bad. I run a VBscript from cmdlines.txt to set all of my RunOnceEx entries.
On Error Resume Next
Dim ws, fs, sysdrv, colDrives, objDrive, strSpace, strOEM
Set ws = WScript.CreateObject("WScript.Shell")
Set fs = CreateObject("Scripting.FileSystemObject")
sysdrv = ws.ExpandEnvironmentStrings ("%SYSTEMDRIVE%")
Set colDrives = fs.Drives
For Each objDrive in colDrives
	If objDrive.DriveLetter & ":" = sysdrv Then
		strSpace = objDrive.TotalSize
		objDrive.VolumeName = "OS"
	End If
	If fs.FileExists(objDrive.DriveLetter & ":\WIN51") Then strOEM = objDrive.DriveLetter & ":\OEM"
Next

'** Subroutine; Set the RunOnceEx key with values
Sub SetROE
	Dim strKeyPath
	strKeyPath = "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnceEx\"
	ws.RegWrite strKeyPath & "TITLE", "Performing Post-Setup Tasks", "REG_SZ"
	ws.RegWrite strKeyPath & "001\", "Preparing the System" , "REG_SZ"
	ws.RegWrite strKeyPath & "001\1", strOEM & "\001_Begin.vbs", "REG_SZ"
	If strSpace > 10737418240 Then
		ws.RegWrite strKeyPath & "010\", "Copying i386 to Local Drive" , "REG_SZ"
		ws.RegWrite strKeyPath & "010\1", strOEM & "\010_CopySource.vbs", "REG_SZ"
	End If
	If strSpace < 42949672960 Then
		ws.RegWrite strKeyPath & "020\", "Compress Select Directories", "REG_SZ"
		ws.RegWrite strKeyPath & "020\1", strOEM & "\020_Compress.vbs", "REG_SZ"
	End If
	If fs.FileExists(strOEM & "\030_Streets.7z") Then
		ws.RegWrite strKeyPath & "030\", "Microsoft Streets and Trips 2005", "REG_SZ"
		ws.RegWrite strKeyPath & "030\1", strOEM & "\030_Streets.vbs", "REG_SZ"
	End If
	If fs.FileExists(strOEM & "\Student\Setup.exe") Then
		ws.RegWrite strKeyPath & "040\", "Microsoft Student 2006", "REG_SZ"
		ws.RegWrite strKeyPath & "040\1", strOEM & "\040_Student.vbs", "REG_SZ"
	End If
	ws.RegWrite strKeyPath & "050\", "Initial Hard Disk Defragmentation", "REG_SZ"
	ws.RegWrite strKeyPath & "050\1", strOEM & "\050_1stDefrag.vbs", "REG_SZ"
	ws.RegWrite strKeyPath & "060\", "Configure the Page File", "REG_SZ"
	ws.RegWrite strKeyPath & "060\1", strOEM & "\060_PageFile.vbs", "REG_SZ"
	ws.RegWrite strKeyPath & "070\", "Configure Accounts", "REG_SZ"
	ws.RegWrite strKeyPath & "070\1", strOEM & "\070_ConfigAccounts.vbs", "REG_SZ"
End Sub

'** Run Tasks
SetROE

And here's my cmdlines.txt:
[Commands]
"cscript cmdlines.vbs"
"GoogleToolbar.exe /q /d"
"PhotoStory3.exe"
"WindowsJournalViewer.exe"
"REGEDIT /S cmdlines.reg"

For some reason my switchless silent installers for PhotoStory 3 and Windows Journal Viewer do not work properly from svcpack.inf, but they run just fine from cmdlines.txt :blink:

This post has been edited by RogueSpear: 02 February 2006 - 09:11 AM


#39 User is offline   gunsmokingman 

  • MSFN Addict
  • Group: Super Moderator
  • Posts: 1,991
  • Joined: 02-August 03
  • OS:none specified
  • Country: Country Flag

Posted 02 February 2006 - 09:20 AM

I have not ran that script during a install, but i have ran some VBS scripts during the 13 minute area.

#40 User is offline   Dobby 

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

Posted 12 February 2006 - 03:18 PM

View PostVAD, on Jun 28 2005, 03:19 AM, said:

ChipCraze23
Well, I don't know about that... I just tested it in RunOnceEx routine. I made two cmd files: each one would ping localhost 5 times and write the results into a different text file for each ping. I ran both files from RunOnceEx with /W switch, and although I couldn't really see the whole execution process, I could see the 10 files and their creation time.

The screenshot is attached (first one). As you can see, they are in a perfect time order. Now look at the second screenshot. The same files ran from RunOnceEx, but without the /W switch. Apparently, the files executed at the same time.

You may have a different testing technique, though, but I can't test this utility from svcpack.inf :) Post your results.


I've also done a RunOnceEx test to check the /W switch works and output gets piped to a file (really important as it helps when debugging dodgy installs) and it seems to work. I'm just about to confirm it by testing my new install on VMware. Will post back results. This util could be just what I'm after.

This post has been edited by Dobby: 12 February 2006 - 03:19 PM


Share this topic:


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

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



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