473,394 Members | 1,867 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

Running a batch file from an ASP.Net page.

UJ
I know I know - I've already posted this in the DOTNET.general area but my
problem seems to be specific to asp.net so I'll recap here......

I (after much work) got to the point where I have a batch file that will do
some commands for me. I can run it from a DOS box, double click on it from
Window's Explorer and can run it from a VB.Net console app. The code for the
console app is here:

Dim p As System.Diagnostics.Process = New System.Diagnostics.Process
Try
p.StartInfo.RedirectStandardOutput = False
p.StartInfo.RedirectStandardError = False
p.StartInfo.UseShellExecute = True
p.StartInfo.FileName =
"C:\MarlinApplication\Contents\Items\792\LeftPanel .bat"
p.Start()
p.WaitForExit()
Catch ex As Exception
Dim lstemp As String
lstemp = ex.Message
Dim t As String
t = lstemp
End Try

The batch file runs some stuff and creates an output file.

This code works just ducky. When I put the exact same code in ASP.Net I get
nothing. No errors, no output file, nothings. Looks like it's not even
running (the WaitForExit returns to quickly.....).

Anybody got any thoughts?

TIA - Jeff
Nov 19 '05 #1
1 1434
Hi,

ASP.NET applications run under the ASPNET account. Maybe that account does
not have enough rights (probably does not by default) to run your file? Or
maybe the .BAT file is run, but what is inside, that cannot run (because
your .BAT is ran with ASPNET account, so are what is inside it).
-Lenard
"UJ" <fr**@nowhere.com> wrote in message
news:uL**************@TK2MSFTNGP14.phx.gbl...
I know I know - I've already posted this in the DOTNET.general area but my
problem seems to be specific to asp.net so I'll recap here......

I (after much work) got to the point where I have a batch file that will
do some commands for me. I can run it from a DOS box, double click on it
from Window's Explorer and can run it from a VB.Net console app. The code
for the console app is here:

Dim p As System.Diagnostics.Process = New System.Diagnostics.Process
Try
p.StartInfo.RedirectStandardOutput = False
p.StartInfo.RedirectStandardError = False
p.StartInfo.UseShellExecute = True
p.StartInfo.FileName =
"C:\MarlinApplication\Contents\Items\792\LeftPanel .bat"
p.Start()
p.WaitForExit()
Catch ex As Exception
Dim lstemp As String
lstemp = ex.Message
Dim t As String
t = lstemp
End Try

The batch file runs some stuff and creates an output file.

This code works just ducky. When I put the exact same code in ASP.Net I
get nothing. No errors, no output file, nothings. Looks like it's not even
running (the WaitForExit returns to quickly.....).

Anybody got any thoughts?

TIA - Jeff

Nov 19 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Brad Smith | last post by:
I have a unique requirement to run an executable file from withing a HTML document. The HTML is actually embedded in an email sent as a notification to a user of our application. I need to include...
0
by: SkySea | last post by:
Hi! Any help on this would be appreciated... In an HTML document that lists instructions on installing some software, there's a point where a DOS batch file needs to be run in order to copy...
9
by: Doug at SAU | last post by:
I need to run a batch file on a remote machine from an ASP page. I dummied up a test ASP page as follows: <% Set WshShell = Server.CreateObject("Wscript.Shell") wshshell.run...
29
by: pb648174 | last post by:
I have a very long transaction that runs on the same database that other users need to use for existing data. I don't care if they see data from the transaction before it is done and am only using...
0
by: joeted | last post by:
Hi, I am using system.diagnostic.process with the intention of running a program to communicate with a unix box: The program is "PuTTY", running from a batch script. I know it works because...
11
by: news | last post by:
I've a PHP script that does some stuff, zips up some files, and starts an FTP process. I need it to do the Zip and FTP in the background and let the page finish, otherwise the user could have...
1
by: Aaron West | last post by:
Try this script to see what queries are taking over a second. To get some real output, you need a long-running query. Here's one (estimated to take over an hour): PRINT GETDATE() select...
6
by: Mat N | last post by:
Hello access friends, (Originally posted on access.formsprogramming which I think was the wrong place) I'm precalculating a bunch of data for my clients as per a profile I have for each of...
0
by: sunrt | last post by:
We have an As400 system that has program which executes batch files which resides on the SQL server 7.0 computer . Those batch files run SQL server jobs using isql. The whole idea about this is...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.