• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 594
  • Last Modified:

I wish to close one batchfile window with another batch file in Windows Dos

I have a batch file that calls two other batchfiles called start_batch.bat


start /min e:\somedir\some.bat

start /min e:\otherdir\other.bat


.....


I'd like a batchfile called stop_batch.bat

??close e:\somedir\some.bat

?close e:\otherdir\other.bat



I'm having trouble finding the ??Close command that I can use.
0
jayrod
Asked:
jayrod
  • 2
1 Solution
 
kcidCommented:
the command you can use is: exit
Look up the options for exit in dos by typing: exit /?

Greetings,

Kcid
0
 
jayrodAuthor Commented:
Nope that doesn't do it.. What I have is... One window open running a process.

I open a second window and I'd like to kill the first window. The only way I can think to do it is to call the batch as a service and use a net stop argument but I was hoping to not have to do that.

Any other ideas?

Thank you for the input though
0
 
pjbcbaCommented:
Can't think of a way of doing this how you propose, without using other scripting tools/languages.. do you want to go down that route?

Otherwise, there may be a possible way around this..
 - The files SOME.BAT and OTHER.BAT are running continously.. so are they looping? If so, are you able to modify these files, or are they provided by someone else?

 - If they are looping and you can edit them... put a flag check within the loop of these batch files, eg:
IF EXIST E:\SOMEDIR\STOP.DAT GOTO END

Then modify the start batch to this:
IF EXIST E:\SOMEDIR\STOP.DAT DEL E:\SOMEDIR\STOP.DAT
start /min e:\somedir\some.bat

So the stop batch would just be:
ECHO. >E:\SOMEDIR\STOP.DAT

If the files aren't looping.. then I can only think of using some other tool like AutoIT, or a scripting language like VBScript or Kixtart.
0
 
jayrodAuthor Commented:
I was hoping to do this without having to modify the existing batch files but This answer is the closest.

thank you
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now