Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

I have a batch file as below: @e

Status
Not open for further replies.

davidrobin

Programmer
Aug 17, 2000
50
GB
I have a batch file as below:

@echo off
rem
rem
cd C:\WINNT
notepad.exe
exit

The problem I have is the command window is staying open as well as notepad. I need the command window to close. How can I make it close.

David
Visual Basic 6 Ent
 
Hi !
Here is how:

@cls
@echo off
start %windir%\notepad.exe
exit


//Greetings Soaplover
 
There does not seem to be an option in XP that allows you to do this (unlike every other version). However you could try the following.

Create a new bat file that contains

cmd /c c:\windows\notepad.exe

create a shortcut to the bat file, right click on the shortcut and select properties. Click on the Shortcut tab and change the Run setting to minimised.

The above will minimise the Dos Window and close it when notepad is closed.

Greg Palmer

----------------------------------------
Any feed back is appreciated.
 
Ahh - We learn something new every day!!!!

Greg Palmer

----------------------------------------
Any feed back is appreciated.
 
This works !!!

@cls
@echo off
start %windir%\notepad.exe
exit

 
If you use:

@cls
@echo off
start /wait %windir%\notepad.exe
exit

Then bat file command window will wait for notepad to finish befoer exiting.

//Soaplover

 
There is no second instance of CMD with a /B switch:

@cls
@echo off
start /B %windir%\notepad.exe
 
For all you helpful people this is what my batch file looks like, it opens word and the a doc file. This is ultimately what I wanted to do.

@echo off
rem
rem
start "c:\program files\microsoft office\office\winword.exe" %1
exit

Thanks all.

David
Visual Basic 6 Ent
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top