لم تعُد "مجموعات Google" تتيح المشاركات أو الاشتراكات الجديدة من Usenet. وسيبقى بالإمكان عرض المحتوى السابق.

How to run a batch file from ASP.Net and also want to pass parameter to a batch file

0 مرّة مشاهدة
التخطي إلى أول رسالة غير مقروءة

Ajit

غير مقروءة،
30‏/04‏/2003، 8:10:52 م30‏/4‏/2003
إلى
Hi,

I want to run a batch file from with in ASP.NET (aspx.vb file)
and also i want to pass a parameter to the batch file.

Do anyone know how to do this ?

Steve C. Orr, MCSD

غير مقروءة،
30‏/04‏/2003، 8:32:57 م30‏/4‏/2003
إلى
This code should do the trick

Dim myprocess As System.Diagnostics.Process = New
System.Diagnostics.Process()
myprocess.StartInfo.FileName = "c:\mybat.bat"
myprocess.StartInfo.WorkingDirectory = "C:\"
myprocess.StartInfo.Arguments= " file.txt -s -m"
myprocess.Start()

--
I hope this helps,
Steve C. Orr, MCSD
http://Steve.Orr.net

"Ajit" <adeo...@thedebtmediator.com> wrote in message
news:%230KeGZ3...@TK2MSFTNGP11.phx.gbl...

Ajit

غير مقروءة،
30‏/04‏/2003، 9:45:15 م30‏/4‏/2003
إلى
Hi Steve,

thanx for your suggession the good thing is it don't give any error but
neither it runs the batch file.

My batch file is Test.bat as below
=======================
@echo off
xcopy %1 "\\ServerName\Users\All\"

And ASP.Net code is
===============
'Run a Batch file
Dim proc As System.Diagnostics.Process = New
System.Diagnostics.Process()
proc.StartInfo.FileName = "C:\test.bat"
proc.StartInfo.WorkingDirectory = "C:\"
proc.StartInfo.Arguments = strFileName
proc.Start()
'proc.WaitForExit()

but in the target folder (\\servername\users\all\) i don't have the copy of
strfilename which is always dynamically generated.

thanx once again

Ajit.


"Steve C. Orr, MCSD" <St...@Orr.net> wrote in message
news:u72O3k3D...@TK2MSFTNGP10.phx.gbl...

Steve C. Orr, MCSD

غير مقروءة،
30‏/04‏/2003، 10:00:59 م30‏/4‏/2003
إلى
Oh, you are trying to run the batch file off of a file share. You didn't
mention that before.
That complicates things.
You need to make sure that your ASPNET account has permission to that file
share, or you need to modify the machine.config to run ASP.NET under a
different account, or you can use impersonation to temporarily get the
necessary permissions for that file share.

--
I hope this helps,
Steve C. Orr, MCSD
http://Steve.Orr.net


"Ajit" <adeo...@thedebtmediator.com> wrote in message

news:%2395O2N4...@TK2MSFTNGP11.phx.gbl...

0 رسالة جديدة