在ps1工具中启动ps1文件

时间:2018-11-13 13:25:47

标签: powershell user-interface launch

您好,我已经创建了一个可以启动中央故障排除应用程序的工具,但是我最近创建了另一个工具ps1文件,但似乎无法从其他工具中启动它

function LaunchQuickNotes {

try { 
    Start-Process -filePath "\\c\s\CAF1\ITSC Second Line Support\Craig Heckles Team\GUI\Admin Tool\QuickNotes Tool\QuickNotes tool - Tier 1.ps1" -
    LogWrite "Quick Notes launched" 
} 
catch {
    $wshell = New-Object -ComObject Wscript.Shell
    $wshell.Popup("Unable to launch Quick Notes.",0,"Error",0)
}

i它似乎只是打开.txt文件,而不是在Powershell中启动。

任何建议

1 个答案:

答案 0 :(得分:2)

代替

Start-Process -filePath "\\c\s\CAF1\ITSC Second Line Support\Craig Heckles Team\GUI\Admin Tool\QuickNotes Tool\QuickNotes tool - Tier 1.ps1" -

尝试

powershell.exe -f "\\c\s\CAF1\ITSC Second Line Support\Craig Heckles Team\GUI\Admin Tool\QuickNotes Tool\QuickNotes tool - Tier 1.ps1"