【IIS】*.batファイルをCGIとして動かす
問題
IISで、*.batファイルをCGIとして動かすには?

答え
web.config に、以下のように記述して、*.batファイルを置く。
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<handlers>
<add name="Batch" path="*.bat" verb="*" modules="CgiModule" scriptProcessor="C:\Windows\System32\cmd.exe /c %s %s" resourceType="Unspecified" />
</handlers>
</system.webServer>
</configuration>
以下のようなスクリプトでレスポンスが返せたりする。
@echo off echo Content-Type: text/plain echo. echo Hello World!! echo. echo.