ending a DOS shell after execution 
Author Message
 ending a DOS shell after execution

Quote:
> Can someone give me a DOS command that will get rid of the shell or else
> tell me another way to take care of the problem?

did you try exit? heheh
well.. you could go to   http://www.*-*-*.com/
and download the OXE that allows you to kill any app via the windows 'end
task'

Dan



Thu, 12 Apr 2001 02:00:00 GMT  
 ending a DOS shell after execution
Hi everyone.

I am using VB to front-end some DOS operations, including XCOPY.

The problem I have is, after the operations are done, I am left with the
DOS window, it says the program is ended, but I want the dos window to go
away.

The program creates, then runs a batch file "xxx.bat" via shell

Every time the timer runs again, I get another shell window left
open--clearly this will consume resources on the server.

Can someone give me a DOS command that will get rid of the shell or else
tell me another way to take care of the problem?

Thanks,

Matthew Cromer



Fri, 13 Apr 2001 03:00:00 GMT  
 ending a DOS shell after execution


Quote:
>Hi everyone.

>I am using VB to front-end some DOS operations, including XCOPY.

Hello Mathew

Dim cmd as string

cmd = environ$("COMSPEC") & " /c"
cmd = cmd & "yourfile.bat"

shell cmd

the comspec part reurns either command.com (95) or cmd.exe (NT)

the /c csues the dos app to close on completion

best wishes, Murray



Fri, 13 Apr 2001 03:00:00 GMT  
 ending a DOS shell after execution
As long as your using a batch file just make CLS the last line.
Quote:



>>Hi everyone.

>>I am using VB to front-end some DOS operations, including XCOPY.
>Hello Mathew

>Dim cmd as string

>cmd = environ$("COMSPEC") & " /c"
>cmd = cmd & "yourfile.bat"

>shell cmd

>the comspec part reurns either command.com (95) or cmd.exe (NT)

>the /c csues the dos app to close on completion

>best wishes, Murray



Fri, 13 Apr 2001 03:00:00 GMT  
 ending a DOS shell after execution
Do you have to see the result of that operations?
If don't, try this.

Shell "YourBatchFile", vbHide

Quote:

>Hi everyone.

>I am using VB to front-end some DOS operations, including XCOPY.

>The problem I have is, after the operations are done, I am left with the
>DOS window, it says the program is ended, but I want the dos window to go
>away.

>The program creates, then runs a batch file "xxx.bat" via shell

>Every time the timer runs again, I get another shell window left
>open--clearly this will consume resources on the server.

>Can someone give me a DOS command that will get rid of the shell or else
>tell me another way to take care of the problem?

>Thanks,

>Matthew Cromer



Fri, 13 Apr 2001 03:00:00 GMT  
 ending a DOS shell after execution

Quote:

>Dim cmd as string

>cmd = environ$("COMSPEC") & " /c"
>cmd = cmd & "yourfile.bat"

>shell cmd

>the comspec part reurns either command.com (95) or cmd.exe (NT)

>the /c csues the dos app to close on completion

>best wishes, Murray

Thanks Murray, that worked.

Can someone tell me what it does?  I don't know what environ$ is.

Thanks.

Matthew Cromer



Sat, 14 Apr 2001 03:00:00 GMT  
 ending a DOS shell after execution
environ$ is an (system) environment variable.....
Quote:



>>Dim cmd as string

>>cmd = environ$("COMSPEC") & " /c"
>>cmd = cmd & "yourfile.bat"

>>shell cmd

>>the comspec part reurns either command.com (95) or cmd.exe (NT)

>>the /c csues the dos app to close on completion

>>best wishes, Murray

>Thanks Murray, that worked.

>Can someone tell me what it does?  I don't know what environ$ is.

>Thanks.

>Matthew Cromer



Sat, 14 Apr 2001 03:00:00 GMT  
 ending a DOS shell after execution

Quote:

> environ$ is an (system) environment variable.....

and can be found in the help file under "Environ function"
Quote:




> >>Dim cmd as string

> >>cmd = environ$("COMSPEC") & " /c"
> >>cmd = cmd & "yourfile.bat"

> >>shell cmd

> >>the comspec part reurns either command.com (95) or cmd.exe (NT)

> >>the /c csues the dos app to close on completion

> >>best wishes, Murray

> >Thanks Murray, that worked.

> >Can someone tell me what it does?  I don't know what environ$ is.

> >Thanks.

> >Matthew Cromer



Sat, 14 Apr 2001 03:00:00 GMT  
 ending a DOS shell after execution

Quote:

>Do you have to see the result of that operations?
>If don't, try this.

>Shell "YourBatchFile", vbHide

The problem with this is, it leaves a dos window behind every time the
timer backs up the files, so you quickly get hundreds of dos windows
eating system resources.

Matthew



Sun, 15 Apr 2001 03:00:00 GMT  
 ending a DOS shell after execution

Quote:


<cut>
>> The problem with this is, it leaves a dos window behind every time the
>> timer backs up the files, so you quickly get hundreds of dos windows
>> eating system resources.

>Simple! Put an EXIT command at end!!

That doesn't work if your system is not set up for 'Close on Exit' by

Cls

Since 'Close on Exit' is assumed if the end screen display is completely
blank.  You can also control it via the Shell call with something like:
x=Shell(Environ$("comspec") & " /c mybatfile myargs",vbNormalFocus)

The Environ$ function makes it work for both 95 & NT and the /c causes it to
run the one command line and then close.



Tue, 17 Apr 2001 03:00:00 GMT  
 
 [ 11 post ] 

 Relevant Pages 

1. determining if a shelled program has ended execution (vb3.0)

2. Detecting end of shelled MS-DOS batch file

3. Waiting until DOS-shell ends...

4. Shelling to dos and retreiving dos error's

5. Ending program execution

6. At wits end..formula execution

7. End VBScript Execution

8. VB5 crashes under W2K after ending execution

9. Shell command execution in VB

10. VB SHELL EXECUTION

11. Execution of shell commands under VB

12. Stopping Execution of an MS-DOS program from VB

 

 
Powered by phpBB® Forum Software