Silent .bat/.cmd file (no window)

K

Kevin

Hi,

Is there any way to make a .bat or .cmd file execute without opening a
console window ? (shortcut/pif trick ?)

If not, is there at least a way to start it minimized ?

(The batch file quickly use the START command but it still opens a console
window for a short time)

Thanks.
 
J

Jeff Qiu [MSFT]

Hi Kevin,

Thanks for posting!

My name is Jeff and I understand your issue to be:
Is there any way to make a .bat or .cmd file execute without opening a
console window?

If I have misunderstood your issue please let me know.

Based on my test, we may run it in a minimized window:

1. Right click the bat file you have created and choose to Send To >
desktop (create shortcut).
2. Right click the shortcut and choose properties.
3. Choose to Minimized from the Run: drop down box.
4. Press OK.
5. Now, run this batch file from this shortcut will get it minimized.

Hope this helps.

Please feel free to let me know if you have any further concerns or
questions regarding the issue.

Best Regards,

Jeff Qiu
Microsoft Online Partner Support
MCSE 2000, MCDBA, MCSA
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.

--------------------
 
R

Ramesh [MVP]

Kevin,

You can script it, and make the .cmd or a .bat run invisible.

Example:
---
Set WshShell = CreateObject("WScript.Shell")
cmds=WshShell.RUN("c:\main.bat", 0, True)
Set WshShell = Nothing
--

Setting intWindowStyle to 0 will hide the output window:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/script56/html/wsmthrun.asp

--
Ramesh - Microsoft MVP
Windows XP Shell
http://www.mvps.org/sramesh2k
---------------------------------------
What You Should Know About the Sasser Worm and It Variants:
http://www.microsoft.com/security/incident/sasser.asp
---------------------------------------


Hi,

Is there any way to make a .bat or .cmd file execute without opening a
console window ? (shortcut/pif trick ?)

If not, is there at least a way to start it minimized ?

(The batch file quickly use the START command but it still opens a console
window for a short time)

Thanks.
 
A

Alex Nichol

Kevin said:
Is there any way to make a .bat or .cmd file execute without opening a
console window ? (shortcut/pif trick ?)

If not, is there at least a way to start it minimized ?

The trick is in setting up a Pif to a bat - by default one will be made
as a LNK. So start by making a shortcut to a known DOS program -
System32\command.com will do - right drag it to the desktop, take Create
Shortcut here. Then right click that (rename if desired) and take
Properties. On the Program page change the command line pane to refer
to your .bat, and in the Run pane select Minimised, check 'close on
exit'
 
Joined
Jul 3, 2009
Messages
1
Reaction score
0
Hi there, this might be a little too simple but its working for me.

if you want to run a program for without having a window or run it minimized, all you have to do is make a bat file like this.


----- without a window-----
@echo off
start /B Myapp.exe


---- minimized ----
@echo off
start /MIN Myapp.exe

and thats it ... hope it helps
 
H

Hot-Text

start /b YOUR_COMMAND arg0 arg1

DOS_COMMAND
/B Restarts your computer after optimization.

regedt32_COMMAND
/s Run regedt32 in Silent

We need to know WHO_COMMAND

So you can have the right
bat/.cmd in (MASM)
Microsoft Assembly Language
in the CMD file....
 
L

lorenzo.godio

start /b YOUR_COMMAND arg0 arg1
DOS_COMMAND

/B Restarts your computer after optimization.

Syntax
START "title" [/Dpath] [options] "command" [parameters]

/B : Start application without creating a new window. In this case
^C will be ignored - leaving ^Break as the only way to
 
A

Andy

Kevin,

You can script it, and make the .cmd or a .bat run invisible.

Example:
---
Set WshShell = CreateObject("WScript.Shell")
cmds=WshShell.RUN("c:\main.bat", 0, True)
Set WshShell = Nothing
--

Setting intWindowStyle to 0 will hide the output window:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/script56/html/wsmthrun.asp

--
Ramesh - Microsoft MVP
Windows XP Shell
http://www.mvps.org/sramesh2k
---------------------------------------
What You Should Know About the Sasser Worm and It Variants:
http://www.microsoft.com/security/incident/sasser.asp
---------------------------------------


Hi,

Is there any way to make a .bat or .cmd file execute without opening a
console window ? (shortcut/pif trick ?)

If not, is there at least a way to start it minimized ?

(The batch file quickly use the START command but it still opens a console
window for a short time)

Thanks.

Can the bat file itself be put into your script so there is only one file ?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top