# UIPATHでのVBSCRIPTの実行

**URL:** <https://forum.uipath.com/t/uipath-vbscript/86017>\
**Category:** フォーラム\
**Tags:** activities\
**Created:** [January 5, 2019, 4:51am UTC](https://forum.uipath.com/t/uipath-vbscript/86017 "2019-01-05T04:51:36Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![matrix99999](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/matrix99999/32/121413_2.png) [@matrix99999](https://forum.uipath.com/u/matrix99999)\
**Post date:** [January 5, 2019, 4:51am UTC](https://forum.uipath.com/t/uipath-vbscript/86017/1 "2019-01-05T04:51:36Z")

</div>

UIPATHでのVBSCRIPTの実行に関してお聞きしたく思います。  
現在、UIPATHでのVBSCRIPTの実行は、cmd.exeを起動させ、例として下記内容を貼り付け  
実行していました。（引数２つ）  
wscript excel2.vbs “d:\uipath\excelvbs” "d:\uipath\excelvbs\result\test.xlsx

start processあるいはInvoke Power Shellで実行できるか試していますがうまくいきません。

１start process  
“cmd /c wscript ‘d:\uipath\excelvbs\excel2.vbs’”  
引数  
VPath01 + " "+ VFile01  
 ![startp](https://global.discourse-cdn.com/uipath/original/3X/1/6/160b1beeffa1a04a0569a98d5791eb5eef193e6e.jpeg)

指定されたファイルが見つかりませんでエラーがでます。

2 invoke Power Shell  
“cmd /c wscript ‘d:\uipath\excelvbs\excel2.vbs’”  
パラメータを下記のように設定しました  
 ![inv2](https://global.discourse-cdn.com/uipath/original/3X/2/e/2ed3a611a53feecdd16d494d79992eecb584202f.jpeg)

 ![inv](https://global.discourse-cdn.com/uipath/original/3X/4/3/433a98115cfbb165869e4baa1963aff81a5d1064.jpeg)

エラーが下記のようになります。  
Source: Invoke Power Shell (Throw)

Message: The term ‘cmd /c wscript ‘d:\uipath\excelvbs\excel2.vbs’’ is not recognized  
as the name of a cmdlet, function, script file, or operable program. Check the spelling  
of the name, or if a path was included, verify that the path is correct and try again.

Exception Type: System.Management.Automation.CommandNotFoundException

多々試しましたがvbsがstart processあるいはInvoke Power Shellで実行できるかご教示いただければと思います。

---

<div class="post-metadata">

**Author:** ![Honoka](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/honoka/32/19907_2.png) [@Honoka](https://forum.uipath.com/u/Honoka)\
**Post date:** [January 5, 2019, 1:24pm UTC](https://forum.uipath.com/t/uipath-vbscript/86017/2 "2019-01-05T13:24:43Z")

</div>

単純にスクリプトを実行するだけなら、Start Processで、

```
FileName に "C:\Windows\System32\wscript.exe"
Arguments 任意のVBSファイルのフルパス （＋必要なら任意の引数）

```

を指定すれば動作します。

但し、Start Processは実行を開始した時点で次のActivityに進むので、VBSファイルの実行完了を待つのであれば、たとえばDo Whileループを使用して起動したプロセス（wscript.exe）が終了するまで待機する、みたいな処理は必要になると思います。

---

<div class="post-metadata">

**Author:** ![matrix99999](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/matrix99999/32/121413_2.png) [@matrix99999](https://forum.uipath.com/u/matrix99999)\
**Post date:** [January 6, 2019, 2:05am UTC](https://forum.uipath.com/t/uipath-vbscript/86017/3 "2019-01-06T02:05:22Z")

</div>

ありがとうございます。  
下記のようにしました。  
 ![startp02](https://global.discourse-cdn.com/uipath/original/3X/6/a/6a1639e6177a54c7652290b7642007c5395b5c56.jpeg)

propertiesでは、  
input  
arguments :VVBS01 + " " + VPath01 + " "+ VFile01  
filename : "C:\Windows\System32\wscript.exe "  
workingDirectory: “d:\uipath\excelvbs”

VBSの処理が終了したかは、処理の順番も含め考えてみます。  
ありがとうございます。
