Invoking Command Prompt

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • gauravgmbhr
    New Member
    • Feb 2007
    • 107

    #1

    Invoking Command Prompt

    Hi All,

    I am trying to run a bat file from ASP and I am new to asp.

    Code:
    	set wshell = CreateObject("WScript.Shell")
                 wshell.Run("c:\file.Bat")
    Nothing is happening in this code. Page is running fine but bat file is not running.
    This bat file is trying to create a folder(My actual requirement is to interact with a application and not creating a folder).

    But the folder is not getting created. I also tried other DOS commands in bat file but nothing happened.
    Is their something I have to do to run bat files before using the above script?
  • DrBunchman
    Recognized Expert Contributor
    • Jan 2008
    • 979

    #2
    If you try and run an exe like Excel using the code above does it work?

    Dr B

    Comment

    • gauravgmbhr
      New Member
      • Feb 2007
      • 107

      #3
      Originally posted by DrBunchman
      If you try and run an exe like Excel using the code above does it work?

      Dr B
      Hi Dr B
      I tried this code on my machine on excel, and worked fine.
      But on machine which ASP and IIS is installed , MS-Ofiice is not installed to i cant say that its working on that machine or not.

      Do i need some library?

      Comment

      • DrBunchman
        Recognized Expert Contributor
        • Jan 2008
        • 979

        #4
        Has the machine got Notepad on or something else you can try? The point of the test is to determine whether the fault lies with the code that's calling the shell (which sounds like it is working) or something else.

        Does the batch file have the desired result if you run it as normal?

        Dr B

        Comment

        • gauravgmbhr
          New Member
          • Feb 2007
          • 107

          #5
          Originally posted by DrBunchman
          Has the machine got Notepad on or something else you can try? The point of the test is to determine whether the fault lies with the code that's calling the shell (which sounds like it is working) or something else.

          Does the batch file have the desired result if you run it as normal?

          Dr B
          Yes the batch file is correct.
          I tried invokin notpad also, its not working.
          Is their any other way using which i can invoke command prompt?

          Comment

          • DrBunchman
            Recognized Expert Contributor
            • Jan 2008
            • 979

            #6
            So the problem probably does lie in the code if notepad is not being executed.

            Have you got any error trapping on your page (On Error Resume Next for example) which you could remove to see whether an error is being thrown?

            Dr B

            Comment

            Working...