Solved

How can I run a batch file minimized without employing the use of another batch file?

Posted on 2015-01-07
6
92 Views
Last Modified: 2015-02-02
I would like to start a batch file minimized, without the need for the batch file to call another batch file to run.
ie.  start /min job.bat

I do not want the above scenario, but one batch file, which starts minimized.

Is there a way to do this?
0
Comment
Question by:100questions
  • 3
  • 2
6 Comments
 
LVL 82

Accepted Solution

by:
oBdA earned 500 total points
Comment Utility
After a fashion; the batch can restart itself minimized and end the first instance.
This example will do just that, while keeping the arguments passed:
@echo off
setlocal
if /i not "%~1"=="/min" (
	start /min "Minimized Command Prompt" %ComSpec% /c ""%~f0" /min %*"
	goto :eof
)
shift
echo Argument 1: %1
echo Argument 2: %2
pause

Open in new window

0
 
LVL 68

Expert Comment

by:Qlemo
Comment Utility
You can use a shortcut set up to start minimized.
Or use cmdow.exe, a free 3rd-party tool, to minimize or control windows including the own.
0
 
LVL 82

Expert Comment

by:oBdA
Comment Utility
The thing with cmdow is that some AV flags it as potentially unwanted program, because it can hide open windows as well.
0
IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 

Author Comment

by:100questions
Comment Utility
oBda, thank you.   Is there somewhere within that batch that I need to insert the name of the file or does it know automatically that it's running itself?
0
 
LVL 82

Expert Comment

by:oBdA
Comment Utility
It'll automatically know its own name and path, that's what "%~f0" in line 4 expands to (enter "help call" in a command prompt for more possibilities).
You can add your own script content starting at line 8, or of course copy lines 1-7 at the beginning of an existing script.
In line 4, you can replace "Minimized Command Prompt" with whatever you want the window title to be.
If your existing script has "setlocal enabledelayedexpansion" at the beginning, adjust line 2 accordingly.
The script window will automatically close itself once it's done; if you want to keep the window open, replace the /c in line 4 with /k.
0
 

Author Closing Comment

by:100questions
Comment Utility
Works very well, after I removed the pause.  Thanks.
0

Featured Post

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

You may have already been in the need to update a whole folder stucture using a script. Robocopy does it well and even provides a list of non-updated files in a log (if asked to). Generally those files that were locked by a user or a process by the …
This article was inspired by a question here at Experts Exchange (http://www.experts-exchange.com/Software/Photos_Graphics/Images_and_Photos/Q_28629170.html). The requirements stated in that question are (1) reduce the file size of a large number of…
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
This tutorial demonstrates a quick way of adding group price to multiple Magento products.

771 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now