![]() |
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-02 00:13 |
48,037 topics / 350,122 posts / today 2 new / 48,250 members |
| DOS批处理 & 脚本技术(批处理室) » How to use a batch file to open a program |
| Printable Version 1,505 / 7 |
| Floor1 aaadxmmm | Posted 2006-07-18 18:06 |
| 新手上路 Posts 3 Credits 10 | |
|
How to use a batch file to open a program
For example, open QQ @echo off "C:\Program Files\QQ2005\QQ.exe" exit After I write it like this, that CMD thing shows up. If after running it, I don't want that CMD thing to show, please help me out, thanks |
|
| Floor2 namejm | Posted 2006-07-18 18:25 |
| 荣誉版主 Posts 1,737 Credits 5,226 From 成都 | |
|
Your problem is actually how to hide the CMD window, not how to open a program. Please pay attention to the change in the thread title.
You can't hide the CMD window just by writing bat code alone; you can only do it with the help of other software. Go to HanHua New Century and download QuickBFC to play with. |
|
| Floor3 aaadxmmm | Posted 2006-07-18 18:38 |
| 新手上路 Posts 3 Credits 10 | |
|
The poster above, I followed your method and downloaded that QBFC, but it still can't get rid of that CMD thing. Someone help me out,
|
|
| Floor4 aaadxmmm | Posted 2006-07-18 18:53 |
| 新手上路 Posts 3 Credits 10 | |
|
I solved it too
@echo off start D:\Real\Real.exe goto end :end It's only after start that if there are spaces in the path, then there will be a problem! |
|
| Floor5 namejm | Posted 2006-07-18 21:07 |
| 荣誉版主 Posts 1,737 Credits 5,226 From 成都 | |
|
Sigh, I thought you wanted to hide the CMD window while running CMD, but it turns out it was that CMD couldn't close automatically. “After I write it like this, that CMD thing shows up. If after running it, I don't want that CMD thing to show” — just look at how you said it. Speechless.
Also: I keep noticing that some people like to use "如果". Could it be that "如果" = “如何”? Using start "program title" "path with spaces" will solve the problem with spaces. |
|
| Floor6 badcfqtd | Posted 2006-07-19 01:32 |
| 中级用户 Posts 53 Credits 232 From 中国 | |
|
Spaces in filenames? I do know that if it's a directory like c:\program files, it can be written as c:\progra~1. If there is also C:\program files2, it can be written as c:\progra~2.
But if the directory name is something like c:\abc def, then I don't know. If anyone has figured it out, say something? |
|
| Floor7 maya0su | Posted 2006-07-19 16:36 |
| 中级用户 Posts 131 Credits 241 | |
|
@echo off
set /p yy=Please enter the program you want to find (you need to include the extension): dir /s/b %yy% >ok.txt set /p uu=<ok.txt start %uu% del ok.txt goto :end :end exit |
|
| Floor8 maya0su | Posted 2006-07-19 16:38 |
| 中级用户 Posts 131 Credits 241 | |
|
This one searches for it and runs it automatically, and it can also exit CMD after running the program...
PS: Whatever drive this .bat is on, it can only search programs on that drive! |
|
|
[ Contact the Union admin team -
中国DOS联盟 -
Standard version ] Sponsored by ifanr Inc | © 2001–2023 |