multiline command parsing


what's explanation keeps
[system.enum]::getvalues([`
system.serviceprocess.servicecontrollerstatus`
])
from parsing same as
[system.enum]::getvalues(`
[system.serviceprocess.servicecontrollerstatus]`
)

in second example not actualy need escape newlines. ;)
re: why ps not understand first one:
guess need have complete tokens e.g.:

g`
wmi

won't work either - backtick not cure linebreak. same with:

[system.enum]:`
:getvalues(

while:

[system.enum]::`
getvalues(

works. can use tokenizer see parts can't broken linebreaks , glued backtick:

[management.automation.psparser]::tokenize('[system.enum]::getvalues([microsoft.powershell.executionpolicy])', [ref]$null)              


Windows Server  >  Windows PowerShell



Comments

Popular posts from this blog

Disconnecting from a Windows Server 2012 R2 file sharing session on a Windows 7,8,10 machine

Error: 0x80073701 when trying to add Print Services Role in Windows 2012 Standard

Windows 2016 RDS event 1306 Connection Broker Client failed to redirect the user... Error: NULL