Any way to Hide the command console?

Discuss anything related to command line tools here.
Post Reply
Message
Author
User avatar
Firewrath
Posts: 321
Joined: Mon Aug 28, 2006 2:36 pm

Any way to Hide the command console?

#1 Post by Firewrath »

I've read this thread, but HStart wants you to buy a license, which kind of goes against what im trying to do / looking for. Anyways, what guinness says in that thread:
guinness wrote:Also NirCmd can also do the same as mentioned above, with also alot more functionality included in the EXE. :D

Code: Select all

NirCmd.exe exec hide “B:\scripts\DropIt_WEB.bat” 
NirCmd.exe exec hide  "B:\scripts\Dropit_vids.bat"
i tried it in a bat file, except like so:

Code: Select all

NirCmd.exe exec hide "calc.bat"
(calc.bat = C:\WINDOWS\system32\calc.exe)

and with NirCmd there is a command window that flashes up for like 1/2 a second, before the calculator runs,

I've also tried:

Code: Select all

NirCmd.exe exec win hide "calc.bat"
but that doesn't seem to work at all, the cmd window still flashes up and the calculator doesn't even run,

so is there Any way out there at all to run a cmd line with Out a window popping up?
and i mean besides things like .bat to .exe programs,
Or did i use the wrong command with NirCmd there? :P

So the reason I want this:
In emails with the Eagle Mode developer, and he said some 3rd party command line functions arnt included with the program because they flash up the console window. He'd like to work on that at some point, but for now has a lot of other things to do. I was really hoping NirCmd could be used to save him some work and specially because of the licensing:
Nir Website wrote: License
This utility is released as freeware. You are allowed to freely distribute this utility via floppy disk, CD-ROM, Internet, or in any other way, as long as you don't charge anything for this. If you distribute this utility, you must include all files in the distribution package, without any modification !
So, Anyone know of anything that'll work and can be included with Eagle Mode?
or am i just screwing up with NirCmd? :P

User avatar
joby_toss
Posts: 2970
Joined: Sat Feb 09, 2008 9:57 am
Location: Romania
Contact:

Re: Any way to Hide the command console?

#2 Post by joby_toss »

That command for Nircmd is "execmd":
execmd [command]
Executes a command of Command-Prompt (Console Window) without displaying anything on the screen.
Examples:
execmd del "~$folder.desktop$\calc.lnk"
execmd mkdir f:\temp\desktop1
execmd copy "~$folder.desktop$\*.lnk" f:\temp\desktop
I also have Hstart v2.2 freeware but distribution is not allowed.
PM me if you need that old DVD back. ;)

User avatar
dmg
Posts: 325
Joined: Fri Jun 04, 2010 2:11 am
Contact:

Re: Any way to Hide the command console?

#3 Post by dmg »

I may be misinterpreting your goal, but if you wish to run batch file like commands including app launching with parameters then you could use AutoHotkey. It can do the same tasks and no prompt window. The syntax is similar in many ways as well.

Sorry if this is not relevant. :)

Marc
Posts: 165
Joined: Sun May 15, 2011 6:06 pm

Re: Any way to Hide the command console?

#4 Post by Marc »

I have HStart v3.1...
Same as Joby_toss ;)

Update: There's another portable program that nicely hides batch windows; works on systems with UAC enabled Here it is

User avatar
tproli
Posts: 1172
Joined: Sat Sep 09, 2006 10:14 am
Location: Hungary
Contact:

Re: Any way to Hide the command console?

#5 Post by tproli »

Nircmd should run the .bat without showing anything with "exec hide". I'm using it in yaP (and elsewhere). You can see its source if you are interested.

Perhaps there is something with your bat file, could you share it?

User avatar
Firewrath
Posts: 321
Joined: Mon Aug 28, 2006 2:36 pm

Re: Any way to Hide the command console?

#6 Post by Firewrath »

Actually, it was me completely screwing up. -_-
I got tired of messing with cmd windows trying other things before remembering NirCmd, so I was running NirCmd from a bat itself at the time, that was the window I had popping up. -_-
(Tproli, both the .bat files I was using were Bat #1: NirCmd.exe exec hide "calc.bat" and Bat #2: C:\WINDOWS\system32\calc.exe ...so there was something 'wrong' with my bat files, the fact I was using one to run NirCmd, >.< )


So I tested it using a vbs scripts I found, and it works fine.

Speaking of said vbs scripts, just save either with the .vbs extension, they should run on winXP and above. Might run on win98 but im not sure.

Code: Select all

Set ws = WScript.CreateObject("WScript.Shell")
cmd = "<.bat Filename Here>"
ret = ws.Run(cmd, 0, True)
Set ws = Nothing
Just replace '<.bat Filename Here>' with the name of your .bat file and there wont be a window popping up, (I used: 'NirCmd.exe exec hide calc.bat' for my test.)
and if you use this:

Code: Select all

Set ws = WScript.CreateObject("WScript.Shell")
dim strEXE
strEXE = """" & WScript.Arguments(0) & """"
cmd = strEXE
ret = ws.Run(cmd, 0, True)
Set ws = Nothing
you can pass a file as an argument, like so:
bat.vbs test.bat
and itll run 'test.bat' without showing a window, I cant get it to pass other arguments after the 'test.bat' though, but I'm sure anyone with vbs knowledge can fix that or such. :P
I have none and just cobbled those together from random scripts I found. ^-^;
But the second one can be used to pass .bat files through the 'sendto' menu and run them without a cmd window, its actually kind of nifty.


As for the other programs, Thanks for mentioning them, as my second purpose for this thread was to gather a bunch of solutions in one place. I found if you google 'hide command console' this thread is actually the 2nd result. (As of this post anyways)
So this will help more then just me. ^-^

Anyways, NirCmd was really what I wanted due to the 'fee use' license, I figure the Eagle Mode Dev can use it as a temporary solution to use any of the other command line tools he might want to include with his program.

And Joby, Thanks but seems I don't need it anymore. 8)

Thanks again guys! ^-^

User avatar
m^(2)
Posts: 890
Joined: Sat Mar 31, 2007 2:38 am
Location: Kce,PL
Contact:

Re: Any way to Hide the command console?

#7 Post by m^(2) »

Years ago I wrote a tool for this purpose.
http://www.multiupload.com/D54NKHUCXD

Code: Select all

hidec calc.bat

User avatar
dany
Posts: 70
Joined: Fri Jun 17, 2011 10:26 pm
Location: netherlands

Re: Any way to Hide the command console?

#8 Post by dany »

Firewrath wrote:I cant get it to pass other arguments after the 'test.bat' though, but I'm sure anyone with vbs knowledge can fix that or such. :P
Go to Rob van der Woude's little FAQ and take a look at runNhide.vbs.

User avatar
Midas
Posts: 6719
Joined: Mon Dec 07, 2009 7:09 am
Location: Sol3

Re: Any way to Hide the command console?

#9 Post by Midas »

Old topic update: just found NoWindow, a FLOSS CLI utility for this precise purpose...
NoWindow is an application that starts programs without visible consoles. It is very short and simple, but can be very useful in avoiding unpleasant CMD, PHP, or application windows when running automated tasks.

NoWindow is currently v1.1 and can be downloaded from this URL.

User avatar
vevy
Posts: 795
Joined: Tue Sep 10, 2019 11:17 am

Re: Any way to Hide the command console?

#10 Post by vevy »

Added to my notes. You know, I have been collecting ever since and one of those days I am gonna go medieval on your a**es with CLI tools :D

User avatar
Midas
Posts: 6719
Joined: Mon Dec 07, 2009 7:09 am
Location: Sol3

Re: Any way to Hide the command console?

#11 Post by Midas »

:lol:

User avatar
Cornflower
Posts: 244
Joined: Fri Aug 31, 2007 7:58 am
Location: Canada's capital

Re: Any way to Hide the command console?

#12 Post by Cornflower »

Here are the ones in my toolkit.

Mystart http://utilfr42.free.fr/util/ 2007. Single purpose, but still works on Windows 10

Phantom http://www.sspxusa.org/goodies A Donation Coder entry from about 2011. If I am looking for small, single-use utility, the Autokey and AutoHotKey coders here made a bunch of great, single use utilities in the 2010s

Hidden Start https://www.ntwind.com/software/hstart.html I have an older version, and only used it for basic hiding of consoles. It is freemium; the paid features allow it to be added as a scheduled task and bypass UAC altogether, and it also works on Windows 11. If someone wants to test that this is true.

Finally, and the one I use with most of my famulus scripts is good ol' Nircmd. https://www.nirsoft.com Eventually I might get rid of the others just to have fewer utilities (I remember when all my tools fit on one 1.44mB diskette--those were the days)

User avatar
Midas
Posts: 6719
Joined: Mon Dec 07, 2009 7:09 am
Location: Sol3

Re: Any way to Hide the command console?

#13 Post by Midas »

FWIW, my main tool for this purpose used to be NTWind Hidden Start -- but over the years it steadily moved away from its more generous beginnings so I dropped it along the way...

m^(2) wrote: Years ago I wrote a tool for this purpose.
http://www.multiupload.com/D54NKHUCXD

Code: Select all

hidec calc.bat
Link's dead; care to repost?


User avatar
Midas
Posts: 6719
Joined: Mon Dec 07, 2009 7:09 am
Location: Sol3

Re: Any way to Hide the command console?

#15 Post by Midas »

Thank you for that, vevy. 8)

Post Reply