Link to home
Start Free TrialLog in
Avatar of tmourad
tmourad

asked on

MS-DOS batch file created in ASP - Can't close it.

I have this code in ASP

     Set MyFile_bat = fs.CreateTextFile(filename_bat, True)
     strLine = "C:\MiniSoft\WS92\ws92_32.exe \\cmr\scripts\mis\minisoft\" & qmake("dt") & ".s92"
     MyFile_bat.writeline strLine
***>>
     MyFile_bat.Close
            Set MyFile_bat = Nothing
-------------------------------------------------------

which creates a batch file to run something else.

I can't seem to be able to close the batch file, which is my goal.
I've tried adding another line (see ***>> above)

     MyFile_bat.writeline "exit"

- it writes 'exit', but doesn't seem to run it.

Anyone have ideas on how to close the batch file ?

Thanks.




Avatar of whammy
whammy

You shouldn't even be able to run the batch file like that, although I assume it's being created.

You need to look at Windows Scripting Host, that should solve your problem. ;-)

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/script56/html/wsobjwshshell.asp
P.S. To run the batch file, just use WSHShell.run("filename") in VBScript:

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/script56/html/wsmthrun.asp
ASKER CERTIFIED SOLUTION
Avatar of DRY_GIN
DRY_GIN

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of tmourad

ASKER

what is interesting is if i write

  MyFile_bat.writeline "cls"

instead of
 
  MyFile_bat.writeline "exit"

it does actually clear the dos window.

so i don't get why exit wouldn't work too.
i will look further into your comments tomorrow.

thanks ! :)
sorry, i completely did not your question in a first place.
Please ignore my comment.

If i got it right this time - your bat file is done, but probably cmd or other container? for the bat is still active
You can try to create VBS script instead of Bat file and check how it is working.
Avatar of Gary
No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area that this question is:

Accept Answer by whammy

Please leave any comments here within the next seven days.
 
PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!
 
GaryC123
EE Cleanup Volunteer