[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1186
  • 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

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

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