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 » Sun Jan 08, 2012 2:31 pm

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
"It's not that I'm Evil, just that I'm unwillingly Good."
-Stolen, but oh so fitting. ^-^

It might take me a while to reply to any post or comments, I only have internet access once a week.
So if I don't reply or miss a question, this is why.

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

Re: Any way to Hide the command console?

#2 Post by joby_toss » Sun Jan 08, 2012 3:03 pm

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: 327
Joined: Fri Jun 04, 2010 2:11 am
Contact:

Re: Any way to Hide the command console?

#3 Post by dmg » Sun Jan 08, 2012 4:18 pm

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. :)
"My dear Mr Gyrth, I am never more serious than when I am joking."
~Albert Campion
------------------------------------------------------------------------
Website | Demo scripts | Blog | External contact

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

Re: Any way to Hide the command console?

#4 Post by Marc » Sun Jan 08, 2012 5:56 pm

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 » Mon Jan 09, 2012 12:01 am

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 » Mon Jan 09, 2012 1:31 am

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! ^-^
"It's not that I'm Evil, just that I'm unwillingly Good."
-Stolen, but oh so fitting. ^-^

It might take me a while to reply to any post or comments, I only have internet access once a week.
So if I don't reply or miss a question, this is why.

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) » Mon Jan 09, 2012 11:43 am

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 » Mon Jan 09, 2012 3:34 pm

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.
GFA/P/S/SS$/O d- s: a>? C++ UL++++ P++@ L++ !E W+++ N++@ o K+ w O M V- PS+++ PE Y+ PGP++>+++ t++ 5+ X++@ R !tv b+>++ DI++ D+ G e+++ h-->- r% y+

Post Reply