Loading ...
Sorry, an error occurred while loading the content.

Using batch files in IIS

Expand Messages
  • Parag Doke
    Hi Batch gurus! I m not sure if this would be the right group to send this mail to, but if someone can direct me towards something, it will be appreciated a
    Message 1 of 4 , Aug 8, 2005
    • 0 Attachment
      Hi Batch gurus!

      I'm not sure if this would be the right group to send this mail to,
      but if someone can direct me towards something, it will be appreciated
      a lot.

      I'm a newbie for batch files trying to work on a Windows 2000 Prof.
      m/c with the IIS that comes with the OS itself. And I'm trying to
      configure my IIS to perform certain actions on the server using batch
      files. This is what I've achieved so far:

      I registered C:\WINNT\system32\CMD.EXE as a script engine as mentioned
      in http://support.microsoft.com/default.aspx?scid=kb;en-us;199828
      (also added the /c & %s %s - though I don't know what the 2 %s mean)
      and I was able to display outputs of some commands in the browser.

      Here's my problem:
      I noticed that even if my Scripts folder (in IIS) has execute
      permissions for Scripts and Executables, only core cmd.exe commands
      are working. Meaning, outputs of "dir /b","set",etc are working
      (displayed in web-browser) but when I use another executable like
      "find.exe" or "findstr.exe", the output is not displayed.

      Example batch file (that works):
      @echo off
      echo Content-Type: text/html
      echo.
      echo.
      echo CD'ing to C:
      cd /d C:\
      dir /b
      exit

      Example batch file (that does not work):
      [Now I created a text file on C:\ with text "parag" (apart from some
      more text).]

      @echo off
      echo Content-Type: text/html
      echo.
      echo.
      echo CD'ing to C:
      cd /d C:\
      echo Looking for text "parag"
      find "parag" *.txt
      exit

      I even tried redirecting the o/p of find,findstr to a temporary text
      file and observed that the file is created but is blank (on the other
      hand, o/p of "dir /b" does get captured in the text file).

      Can someone please help me with this? (Or direct to an appropriate
      source of information?)
      -Parag P. Doke
      [P.S.-I'm not very good at English so if I sounded harsh somewhere,
      please forgive me.]
    • Parag Doke
      I guess it is the author of document http://www.eaves.org/jon/work/info/iis-batch.txt whom I should get in touch with... Thanks everyone for your time, Parag
      Message 2 of 4 , Aug 8, 2005
      • 0 Attachment
        I guess it is the author of document
        http://www.eaves.org/jon/work/info/iis-batch.txt whom I should get in
        touch with...

        Thanks everyone for your time,
        Parag P. Doke
      • foxidrive
        ... Try this: @echo off echo Content-Type: text/html echo. echo. echo CD ing to C: cd /d C: echo Looking for text parag cmd /c find parag *.txt exit --
        Message 3 of 4 , Aug 9, 2005
        • 0 Attachment
          On Mon, 8 Aug 2005 21:58:43 +0530, Parag Doke wrote:

          > I'm a newbie for batch files trying to work on a Windows 2000 Prof.
          > m/c with the IIS that comes with the OS itself. And I'm trying to
          > configure my IIS to perform certain actions on the server using batch
          > files. This is what I've achieved so far:
          >
          > I registered C:\WINNT\system32\CMD.EXE as a script engine as mentioned
          > in http://support.microsoft.com/default.aspx?scid=kb;en-us;199828
          > (also added the /c & %s %s - though I don't know what the 2 %s mean)
          > and I was able to display outputs of some commands in the browser.
          >
          > Here's my problem:
          > I noticed that even if my Scripts folder (in IIS) has execute
          > permissions for Scripts and Executables, only core cmd.exe commands
          > are working. Meaning, outputs of "dir /b","set",etc are working
          > (displayed in web-browser) but when I use another executable like
          > "find.exe" or "findstr.exe", the output is not displayed.
          >
          > Example batch file (that works):
          > @echo off
          > echo Content-Type: text/html
          > echo.
          > echo.
          > echo CD'ing to C:
          > cd /d C:\
          > dir /b
          > exit
          >
          > Example batch file (that does not work):
          > [Now I created a text file on C:\ with text "parag" (apart from some
          > more text).]
          >
          > @echo off
          > echo Content-Type: text/html
          > echo.
          > echo.
          > echo CD'ing to C:
          > cd /d C:\
          > echo Looking for text "parag"
          > find "parag" *.txt
          > exit
          >

          Try this:

          @echo off
          echo Content-Type: text/html
          echo.
          echo.
          echo CD'ing to C:
          cd /d C:\
          echo Looking for text "parag"
          cmd /c find "parag" *.txt
          exit



          --
          Regards,
          Mic
        • Parag Doke
          Hi Mic ! Thanks for suggesting the cmd /c (which I understand is to close the new console that will open up to execute the find command). But when I tried, it
          Message 4 of 4 , Aug 11, 2005
          • 0 Attachment
            Hi Mic !
            Thanks for suggesting the cmd /c (which I understand is to close the
            new console that will open up to execute the find command). But when I
            tried, it did not work (from the console there is no problem - but the
            batch file does not work when accessed from a web browser).

            I was wondering what the "%s %s" mean when one registers cmd.exe as a
            script engine.

            BTW, I found document
            http://www.mcenter.com/mailpost/help/Q190002.html that has the
            solution to this problem for IIS 4.0 (the one I mailed this group
            earlier should work for IIS 3.0). I was able to proceed with my
            requirement.

            [I tried the cmd /c option on a m/c where both these workaorunds were
            NOT applied.]

            Sorry for the late reply.
            Thanks again for all the time and attention,
            Parag P. Doke


            On 8/9/05, foxidrive <foxidrive@...> wrote:
            > On Mon, 8 Aug 2005 21:58:43 +0530, Parag Doke wrote:
            >
            > > I'm a newbie for batch files trying to work on a Windows 2000 Prof.
            > > m/c with the IIS that comes with the OS itself. And I'm trying to
            > > configure my IIS to perform certain actions on the server using batch
            > > files. This is what I've achieved so far:
            > >
            > > I registered C:\WINNT\system32\CMD.EXE as a script engine as mentioned
            > > in http://support.microsoft.com/default.aspx?scid=kb;en-us;199828
            > > (also added the /c & %s %s - though I don't know what the 2 %s mean)
            > > and I was able to display outputs of some commands in the browser.
            > >
            > > Here's my problem:
            > > I noticed that even if my Scripts folder (in IIS) has execute
            > > permissions for Scripts and Executables, only core cmd.exe commands
            > > are working. Meaning, outputs of "dir /b","set",etc are working
            > > (displayed in web-browser) but when I use another executable like
            > > "find.exe" or "findstr.exe", the output is not displayed.
            > >
            > > Example batch file (that works):
            > > @echo off
            > > echo Content-Type: text/html
            > > echo.
            > > echo.
            > > echo CD'ing to C:
            > > cd /d C:\
            > > dir /b
            > > exit
            > >
            > > Example batch file (that does not work):
            > > [Now I created a text file on C:\ with text "parag" (apart from some
            > > more text).]
            > >
            > > @echo off
            > > echo Content-Type: text/html
            > > echo.
            > > echo.
            > > echo CD'ing to C:
            > > cd /d C:\
            > > echo Looking for text "parag"
            > > find "parag" *.txt
            > > exit
            > >
            >
            > Try this:
            >
            > @echo off
            > echo Content-Type: text/html
            > echo.
            > echo.
            > echo CD'ing to C:
            > cd /d C:\
            > echo Looking for text "parag"
            > cmd /c find "parag" *.txt
            > exit
            >
            >
            >
            > --
            > Regards,
            > Mic
            >
            >
            > To Post a message, send it to: batchworld@...
            >
            > To Unsubscribe, send a blank message to: batchworld-unsubscribe@...
            > Yahoo! Groups Links
            >
            >
            >
            >
            >
            >
            >
            >
          Your message has been successfully submitted and would be delivered to recipients shortly.