• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1192
  • Last Modified:

Send parameters to EXE file by Asp.net(VB)

Hello expert ,

i can ran BAT file by this code
<script language="VB" runat ="server">
Sub Page_load(sender as object, E as Eventargs)
        Dim s As New System.Diagnostics.Process
        s.StartInfo.FileName = "d:\myfile.bat"
        s.Start()
end sub
</script>

but i had 2 questions

1 . how i send some parameters to EXE filev(code it asp.net file)

2. how i get parameters in BAT file (code in BAT file)


0
sirimit
Asked:
sirimit
1 Solution
 
riyasjefCommented:
Like this

1. Use 'Arguments' property of StartInfo to pass the parameters
    s.StartInfo.Arguments="Arg1 Arg2"
2.  Use %(variable) in batch file- to get the parameters passed
    Echo %1 %2

Regards,
RJ
0
 
sirimitAuthor Commented:
Hello RJ,

i found new problem

if i edit test.bat file is  "SHUTDOWN -r -t 01"

and  aspx file is
**************************
        Dim s As New System.Diagnostics.Process
        s.StartInfo.FileName = "d:\test.bat"
        s.Start()
**************************
when i call aspx file it not show any error but
server not restart

please suggest me

thank you so much

0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now