Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

hide command prompt with batch file

Status
Not open for further replies.

hinchdog

Programmer
Feb 14, 2001
380
US
i have a batch file with the following code

@ECHO OFF
wrapper /i LPLocker.msi
EXIT

this batch launches an executable Wrapper.exe, then opens the setup package LPLocker.msi. Now, this works fine but you can see the command prompt the whole time. i want the command prompt to be minimized or entirely invisible. that's what i thought the ECHO OFF did. but i was wrong because i can still see it. anyone know the proper commands to do this. THX

btw - i want the solution to be cross platform
 
As one possible solution you could use ANSI.SYS and specify the color of the prompt the same as the background. Ed Fair
unixstuff@juno.com
Any advice I give is my best judgement based on my interpretation of the facts you supply. Help increase my knowledge by providing some feedback, good or bad, on any advice I have given.
 
“@ECHO OFF” just stops the text of your batch file being echoed to the console. To hide the DOS command prompt, put the following as the second line of your batch file,( after “ECHO OFF”):

prompt=$H

(This issues a backspace command and should work in any system runing MS-DOS 3.3 or above.)


 
Maybe use CLS (Clear Screen)?..
At least this way it'll run everything and then Clear it afterwards, so...

@ECHO OFF
wrapper /i LPLocker.msi
CLS
EXIT

Rgds
 
thanks everyone! great solutions and i will try them all ;-)
 
unfortunately, i tried them all and none seemed to work. except changing the prompt background, since the background color will always be different. anyways, guess i'll just have to live with it. thx
 
in EXPLORER, right click on your batch file
choose 'Properties'
choose the 'Program' tab
choose 'Minimized' from the 'Run' drop-down list
 
that didn't seem to work either, but thanks for the suggestion.
 
it works in sofar as it moves the cursor down two lines, but does not hide the command prompt.
 
Do you have conrol of the background color? Ed Fair
unixstuff@juno.com
Any advice I give is my best judgement based on my interpretation of the facts you supply. Help increase my knowledge by providing some feedback, good or bad, on any advice I have given.
 
i didn't want to try that solution because the background could be anything. maybe i'm wrong on this. please explain what you mean by "set the background color the the background". thanks
 
In dos you have control of background and foreground colors. You can issue new color info at any time , to the background, foreground, or both.
In those cases where I control the colors I set both and do a CLS so the entire page shows continuous rather than the chopped blocks that changing in the middle of the screen leaves.
I haven't had any reason to try it with a dos window but you've raised an interesting question so I guess I'll do it now to satisfy my curiosity. Ed Fair
unixstuff@juno.com
Any advice I give is my best judgement based on my interpretation of the facts you supply. Help increase my knowledge by providing some feedback, good or bad, on any advice I have given.
 
ok, i see now. would appreciate if you would share that code after you test it. i'm very new to dos and need all the help i can get!! :)
 
two batch files hide and unhide
hide.bat
@prompt $e[0;34;44m
cls

and unhide
the same except 37;44

requires devicehigh=c:\winxxx\command\ansi.sys in your config.sys file.

hide makes foreground blue(34) and background blue(44)
unhide make foreground white
other prompt commands can be added Ed Fair
unixstuff@juno.com
Any advice I give is my best judgement based on my interpretation of the facts you supply. Help increase my knowledge by providing some feedback, good or bad, on any advice I have given.
 
unfortunately i can't test this since i'm operating on windows 2000. no config.sys file.
 
I'll check on 2000 with a cust's machine. Just may require loading the driver at a different place. I'm still mostly 95A and SE. Ed Fair
unixstuff@juno.com
Any advice I give is my best judgement based on my interpretation of the facts you supply. Help increase my knowledge by providing some feedback, good or bad, on any advice I have given.
 
There's a nice little program that PC Mag published a while back called ANSI.COM. This lets you use all the same ASNI formatting codes, but it loads dynamically, so you don't have to load ANSI.SYS from a config file. You just load it at the beginning of your batch file, issue the ANSI codes and other commands, then unload it at the end, like this:
Code:
@echo off
cls
ansi.com /q
prompt $e[0;34;44m
{insert your stuff here}
Code:
prompt $e[0;37;44m
ansi /u
exit

The "/q" is Quiet mode (surpresses the copyright display) and the "/u" is to unload it from memory.

I used to use this quite a lot, though I can't say for sure it'll work under Win2K. Worth a try though.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top