LoginSignup
3

More than 5 years have passed since last update.

作業ディレクトリを指定してプログラムを実行

Posted at

exeをおいているディレクトリにてexeを実行することを想定されているプログラムの場合、
カレントディレクトリを指定しないと正しく実行できない事があります。

workingdir.vbs
Option Explicit
Dim wShell
Set wShell = CreateObject("WScript.Shell")
wShell.CurrentDirectory = "c:\Program Files\sample"
' 実行プログラムの指定はダブルクォーテーションでくくること。
wShell.Run """c:\Program Files\sample\program.exe""",1,TRUE

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
3