Команда PowerShell в несколько строк

У меня есть пакетный скрипт, который выглядит следующим образом:

Test.bat
@echo off

:: Starts a PowerShell session that starts a PowerShell process with administrator privileges
powershell -noprofile -command "&{$process = start-process powershell -ArgumentList '-noprofile -noexit -file GetTools.ps1' -verb RunAs -PassThru;$process.WaitForExit();}"

Я хотел бы разделить код внутри & quot; & amp; {...} & quot; на несколько строк для удобства чтения.

это сообщение говорит, что использование конечного обратного удара должно помочь, но когда я пишу:

powershell -noprofile -command "&{`
    $process = start-process powershell -ArgumentList '-noprofile -noexit -file GetTools.ps1' -verb RunAs -PassThru;`
    $process.WaitForExit();`
}"

... то есть я заканчиваю каждую строку конечным обратным тылом, затем получаю следующую ошибку:

Incomplete string token.
At line:1 char:4
+ &{` <<<<
    + CategoryInfo          : ParserError: (`:String) [], ParentContainsErrorRecordException
    + FullyQualifiedErrorId : IncompleteString

'$process' is not recognized as an internal or external command,
operable program or batch file.
'$process.WaitForExit' is not recognized as an internal or external command,
operable program or batch file.
'}"' is not recognized as an internal or external command,
operable program or batch file.

Что я делаю неправильно?

SOLUTION:

powershell -noprofile -command "&{"^
    "$process = start-process powershell -ArgumentList '-noprofile -noexit -file C:\Dev\Powershell\Sandbox.ps1' -verb RunAs -PassThru;"^
    "$process.WaitForExit();"^
    "}"

Ответы на вопрос(2)

Ваш ответ на вопрос