在 ps1 工具中启动 ps1 文件
launching a ps1 file within a ps1 tool
您好,我创建了一个启动中央故障排除应用程序的工具,但我最近创建了另一个工具 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)
}
我似乎只是打开 .txt 文件而不是在 powershell 中启动。
有什么建议
而不是
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"
您好,我创建了一个启动中央故障排除应用程序的工具,但我最近创建了另一个工具 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)
}
我似乎只是打开 .txt 文件而不是在 powershell 中启动。
有什么建议
而不是
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"