Solved

close command prompt after executing as batch file

Posted on 2013-02-01
4
1,008 Views
Last Modified: 2013-02-02
Hi Experts,

Probably I am asking very stupid question. But I can't do it anyway.

I put a batch file in windows startup, from where one exe is called. Thats it. I need to close the batch file after invoking that exe. The problem is the command prompt is stay opened after invoking that exe. How to close that command prompt (i.e. dos window)?

Please help,

Soumen
0
Comment
Question by:Soumen-Roy
  • 2
4 Comments
 
LVL 43

Accepted Solution

by:
Steve Knight earned 500 total points
ID: 38846212
if it is only one exe you could run it instead of the batch but if you want to do it in the batch then use the START keyword.  that makes it run the other app then carry on straight away, normally in a batch if you run an exe you want it to wait and do them in order.

with start the first parameter in quotes is the window title so if you need quotes because of spaces in exe path or name then use:

start "" "c:\program files\.....yourexe.exe"

or

start c:\shortpath\yourexe.exe

hth

Steve
0
 
LVL 7

Expert Comment

by:karunamoorthy
ID: 38846290
You can try this sample batch file

=========
TITLE My batch file
:: content here
start calc
GOTO :END
:END
FOR /l %%a in (5,-1,1) do (TITLE %TITLE% -- Closing in %%as&ping -n 2 -w 1 127.0.0.1>NUL)
:: then, explicit exit (not required)
exit /B 1 >nul
==========

The above batch file opens calc program and closes dos box after 5 seconds. You can modify this to suit your requirement
0
 

Author Closing Comment

by:Soumen-Roy
ID: 38846292
thanx, its just what i expected.
thanx a lot
0
 
LVL 43

Expert Comment

by:Steve Knight
ID: 38846713
no problem.

steve
0

Featured Post

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

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…
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
This tutorial demonstrates a quick way of adding group price to multiple Magento products.
A company’s greatest vulnerability is their email. CEO fraud, ransomware and spear phishing attacks are the no1 threat to a company’s security. Cybercrime is responsible for the largest loss of money to companies today with losses projected to r…

914 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

18 Experts available now in Live!

Get 1:1 Help Now