![]() |
China DOS Union-- Unite DOS · Advance DOS · Grow DOS --Union site: www.cn-dos.net Forum site: www.cn-dos.net/forum |
| Guest | Log in | Register | Members | Search | China DOS Union |
|
中国DOS联盟论坛 The time now is 2026-08-12 22:17 |
47,811 topics / 349,897 posts / today 0 new / 48,256 members |
| DOS批处理 & 脚本技术(批处理室) » [Help] How to hide the DOS window |
| Printable Version 5,287 / 20 |
| Floor1 crystal0808 | Posted 2008-11-26 11:27 |
| 新手上路 Posts 20 Credits 6 | |
|
Hello everyone, I'm running into a problem now and still haven't been able to solve it, so I had no choice but to post here for help. I hope you can help me out.
Here's the situation. For example, I wrote a batch file like this: Here, set.bat is used to set environment variables, and a.exe needs those environment variables to be set before it can run. My problem is that when I run this bat file, a DOS window flashes by while set.bat is setting the environment variables. I've already looked through other posts in the forum. I don't want to use vbs, and I also don't want to rely on third-party software and make it so troublesome. I don't know whether there is any other way. set.bat is used to set environment variables, so I don't know whether there is some other way to set environment variables in the background, or hide that DOS window that flashes by, or minimize the DOS window. In short, as long as it doesn't feel like the DOS window exists, that's fine. Does anyone have a good solution? As for the call line, I tried start /min. It did minimize it, but it didn't exit automatically, and the environment variables it set actually had no effect on a.exe, which is really depressing. I wonder whether any experts here have a good trick for this. Thanks in advance. [ Last edited by crystal0808 on 2008-11-26 at 11:29 ] |
|
| Floor2 tireless | Posted 2008-11-26 12:15 |
| 银牌会员 Posts 1,122 Credits 2,025 | |
|
I think it should be start a.exe that's flashing out. Try start /b a.exe
[ Last edited by tireless on 2008-11-26 at 12:53 ] |
|
| Floor3 crystal0808 | Posted 2008-11-26 14:00 |
| 新手上路 Posts 20 Credits 6 | |
Originally posted by tireless at 2008-11-26 12:15: It's not start a.exe that's flashing out. I added a pause inside set.bat, and found that the flashing window is set.bat's. After start a.exe opens, it has an interface, so it doesn't flash |
|
| Floor4 HAT | Posted 2008-11-26 14:02 |
| 版主 Posts 5,017 Credits 9,023 | |
|
Can you post the contents of set.bat so we can take a look?
|
|
| Floor5 crystal0808 | Posted 2008-11-26 18:06 |
| 新手上路 Posts 20 Credits 6 | |
Originally posted by HAT at 2008-11-26 14:02: There's really nothing much in it. It's just setting environment variables. For example: It's just a single line setting an environment variable, so it flashes by very quickly |
|
| Floor6 HAT | Posted 2008-11-26 18:18 |
| 版主 Posts 5,017 Credits 9,023 | |
| Floor7 crystal0808 | Posted 2008-11-26 18:39 |
| 新手上路 Posts 20 Credits 6 | |
Originally posted by HAT at 2008-11-26 18:18: Would it work if I call another bat file? Because set.bat may be called by multiple files, and it may also be modified later. If it's like this every time, maintenance is a bit troublesome. Thanks ^_^ |
|
| Floor8 crystal0808 | Posted 2008-11-26 18:50 |
| 新手上路 Posts 20 Credits 6 | |
Originally posted by HAT at 2008-11-26 18:18: The window still exists, so maybe it's this bat file itself. And there's another problem: if wmic is used and the user doesn't have it installed, a window will pop up to install it. Also, after the user runs this command for the first time and the environment variable is set, a.exe still can't be used at all. Maybe it's because the environment variables haven't been refreshed. Anyway, it still hasn't achieved the expected effect |
|
| Floor9 crystal0808 | Posted 2008-11-26 20:37 |
| 新手上路 Posts 20 Credits 6 | |
|
I feel that the flashing window is the first bat file's, not the set.bat being called, so now the issue is how to add a command or parameter in a shortcut command so that when this file is opened, the DOS window doesn't flash or is minimized.
Under the interface we can choose it manually, but is there some command that can set it? |
|
| Floor10 HAT | Posted 2008-11-26 20:40 |
| 版主 Posts 5,017 Credits 9,023 | |
|
10 ideas for running batch files hidden
http://www.cn-dos.net/forum/viewthread.php?tid=23846 |
|
| Floor11 crystal0808 | Posted 2008-11-26 20:48 |
| 新手上路 Posts 20 Credits 6 | |
Originally posted by HAT at 2008-11-26 20:40: I've read that already. It doesn't seem very practical. I can't use those; above I already said to keep extra stuff to a minimum |
|
| Floor12 hong33315 | Posted 2008-12-28 10:08 |
| 新手上路 Posts 6 Credits 8 | |
|
Yeah, how can this be done with DOS commands?
Making it into a service would also be fine |
|
| Floor13 seraph5186 | Posted 2009-01-14 16:48 |
| 新手上路 Posts 4 Credits 8 | |
|
Does your set.bat pop up a window? I ran it and didn't get the behavior you described...
|
|
| Floor14 5872169 | Posted 2009-01-14 17:59 |
| 高级用户 Posts 474 Credits 959 | |
|
This topic has already been discussed who knows how many times on our forum. It's impossible to hide it. You can only use a BAT-to-EXE program, or use VBS association
|
|
| Floor15 lidongyun | Posted 2009-05-07 10:02 |
| 新手上路 Posts 10 Credits 9 | |
|
I want to know too
|
|
| 1 2 Next |
|
[ Contact the Union admin team -
中国DOS联盟 -
Standard version ] Sponsored by ifanr Inc | © 2001–2023 |