Non solo per il manifesto originale di questa domanda, ma per gli altri che potrebbero atterrare qui in cerca di risposte , il sistema di aiuto è molto utile e sembra essere spesso trascurato.
Utilizzo del comando /? o in PowerShell
i comandi get-help
e get-help -full
sono tutti utili.
Probabilmente avresti potuto rispondere alla tua domanda leggendo la guida per il comando che volevi eseguire, powershell
in questo caso.
PowerShell[.exe] [-PSConsoleFile <file> | -Version <version>]
[-NoLogo] [-NoExit] [-Sta] [-Mta] [-NoProfile] [-NonInteractive]
[-InputFormat {Text | XML}] [-OutputFormat {Text | XML}]
[-WindowStyle <style>] [-EncodedCommand <Base64EncodedCommand>]
[-File <filePath> <args>] [-ExecutionPolicy <ExecutionPolicy>]
[-Command { - | <script-block> [-args <arg-array>]
| <string> [<CommandParameters>] } ]
PowerShell[.exe] -Help | -? | /?
-NoExit
Does not exit after running startup commands.
...
-File
Runs the specified script in the local scope ("dot-sourced"), so that the
functions and variables that the script creates are available in the
current session. Enter the script file path and any parameters.
File must be the last parameter in the command, because all characters
typed after the File parameter name are interpreted
as the script file path followed by the script parameters.
-NoExit - non esce dopo l'esecuzione di comandi di avvio.
-File - ... file deve essere l'ultimo parametro nel comando ...
fonte
2016-03-20 17:19:13
'inizio PowerShell -noexit -file "D: \ MyToolkit \ ToolKit.ps1"' – Avshalom
Grazie! Lavorato! Non ha funzionato quando l'ho messo alla fine, ma quando l'ho messo prima -Commandit ha funzionato – pencilCake