从单个PowerShell脚本调用多个powershell脚本

时间:2016-07-25 14:56:50

标签: powershell

如何从单个PowerShell脚本调用多个PowerShell脚本?

我在网络搜索中有这个 -

文件“FolderWatcherMain.ps1”包含代码:

$ExternalMethod = "D:\a\FolderWatcher1.ps1"
.$ExternalMethod
$ExternalMethod = "D:\a\FolderWatcher2.ps1"
.$ExternalMethod

这不起作用。亲爱的会员们的任何建议。谢谢。

2 个答案:

答案 0 :(得分:0)

如果要在字符串变量中保存PS脚本的路径,请使用&运算符来访问它:

$ExternalMethod = "D:\a\FolderWatcher1.ps1"
& $ExternalMethod

或者您可以使用Start-Process,如果需要,可以提供-Wait参数:

$ExternalMethod = "D:\a\FolderWatcher1.ps1"
Start-Process PowerShell -Argument $ExternalMethod -Wait

答案 1 :(得分:0)

会是这样的

<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<select type="text" class="form-control" placeholder="Degree..." id="userEducationDegree">
            <option value="-1">--Select--</option>
            <option value="A">A</option>
            <option value="B">B</option>
            <option value="C">C</option>
</select>