?
Solved

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

Posted on 2003-03-11
6
Medium Priority
?
230 Views
Last Modified: 2010-08-05
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.




0
Comment
Question by:tmourad
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
6 Comments
 
LVL 4

Expert Comment

by:whammy
ID: 8115692
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
0
 
LVL 4

Expert Comment

by:whammy
ID: 8115964
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
0
 
LVL 3

Accepted Solution

by:
DRY_GIN earned 225 total points
ID: 8116209
make sure filename_bat is pointed to the folder with write access to ASP user.
If you are saying that file is created OK and just not closed (it is hard to believe that such thing can occure),
anyway - maybe you need to try different file name and write it only once, in case if some different process using this file.
or kill that file before you are creating it.
anyway if the problem only in closing - try "objectless" string:

CreateObject("Scripting.FileSystemObject").CreateTextFile(server.MapPath("/" & filename_bat), True).write("C:\MiniSoft\WS92\ws92_32.exe \\cmr\scripts\mis\minisoft\" & qmake("dt") & ".s92")

if you don't have permission to write (in my case it would be a root web folder) - you will get "Permission denided" ASP error

good luck
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:tmourad
ID: 8117044
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 ! :)
0
 
LVL 3

Expert Comment

by:DRY_GIN
ID: 8118045
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.
0
 
LVL 58

Expert Comment

by:Gary
ID: 9352451
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
0

Featured Post

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

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

Hello, all! I just recently started using Microsoft's IIS 7.5 within Windows 7, as I just downloaded and installed the 90 day trial of Windows 7. (Got to love Microsoft for allowing 90 days) The main reason for downloading and testing Windows 7 is t…
I was asked about the differences between classic ASP and ASP.NET, so let me put them down here, for reference: Let's make the introductions... Classic ASP was launched by Microsoft in 1998 and dynamically generate web pages upon user interact…
Michael from AdRem Software outlines event notifications and Automatic Corrective Actions in network monitoring. Automatic Corrective Actions are scripts, which can automatically run upon discovery of a certain undesirable condition in your network.…
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…
Suggested Courses

771 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