はい、Internet Exlorerを使用する場合は可能ですが、実行するにはIEのセキュリティ設定を低く保つ必要があり、それでも確認を求めるプロンプトが表示される場合があります。すべては、WindowsのバージョンとSP、セキュリティの更新、IEのバージョン、およびIEの設定によって異なります。
この方法でローカルスクリプトを開始する理由をもう一度確認することをお勧めします。設定やプロンプトに煩わされることなく、スクリプトを開始するショートカットを簡単に作成して配布できます。
Vbscriptビルトインを使用できるユーザーインターフェイスが必要な場合、または.htmlまたは.aspファイルの代わりに.HTAファイルを使用できる場合は、これらのファイルのセキュリティはそれほど問題になりません。
例:test.html
<script type="text/vbscript" src="c:\temp\test.vbs"></script>
およびtest.vbs
Const ForReading = 1, ForWriting = 2
Set fso = CreateObject("Scripting.FileSystemObject")
Set writefile = fso.OpenTextFile("c:\temp\output.txt", ForWriting, True)
writefile.write "test"
writefile.close
test.htmlをロードすると、2つのプロンプトが表示され、確認すると、c:\tempにoutput.txtが表示されます。
最後に、.htaファイルを使用した例を示します。たとえば、test.htaとして保存します。また、ActiveXまたはVbscriptを使用する場合はalwyasがIEを使用します。
<HTML>
<HEAD>
<SCRIPT language="VBScript">
<!--
Const ForReading = 1, ForWriting = 2
Set fso = CreateObject("Scripting.FileSystemObject")
Set writefile = fso.OpenTextFile("c:\temp\output.txt", ForWriting, True)
writefile.write "test"
writefile.close
'-->
</SCRIPT>
</HEAD>
<BODY>
</BODY>
</HTML>
また
<HTML>
<HEAD>
<script type="text/vbscript">
sub test
const runminimized = 7
const dont_wait_for_end = false
Set wshShell = CreateObject("WScript.Shell")
WshShell.Run "c:\temp\test.vbs",runminimized, dont_wait_for_end
end sub
</script>
</HEAD>
<BODY>
these are the instructions
<button onclick="vbscript:test" >Run the script</button>
</BODY>
</HTML>