Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Line break handling in PowerShell #3433

Closed
simoniscasesensitive opened this issue Nov 4, 2019 · 2 comments
Closed

Line break handling in PowerShell #3433

simoniscasesensitive opened this issue Nov 4, 2019 · 2 comments
Labels
Resolution-Duplicate There's another issue on the tracker that's pretty much the same thing.

Comments

@simoniscasesensitive
Copy link

simoniscasesensitive commented Nov 4, 2019

Environment

Windows 10, PS 6, Windows Terminal.

Win32NT 10.0.18362.0 Microsoft Windows NT 10.0.18362.0
PSVersion 5.1.18362.145
BuildVersion 10.0.18362.145
Windows Terminal version 0.6.2951.0

In addition to trying the ootb PowerShell experience, I've added in a profile matching my SharePoint Online Management Shell shortcut (other than the GUID which I just modified from the standard PS one). Behaviour below replicated in both windows/environments.

{ "guid": "{61c54bbd-c2c6-5271-96e7-009a87ff44bc}", "name": "SPO PowerShell", "commandline": "powershell.exe -NoExit -Command \"Import-Module Microsoft.Online.SharePoint.PowerShell -DisableNameChecking;\" ", "hidden": false },

Steps to reproduce

Fairly simple really, I have a variable assignment in PowerShell that breaks over multiple lines for readability, but PS in Terminal interprets as multiple commands.
I completely accept there may be a simple modification to the way I've been doing it that'll make it work in PS as delivered by Windows terminal. Problem may be sitting between chair and keyboard.

I've tried:
$MyDocs = [environment]::getfolderpath("mydocuments")

`
$Dlls = ("$MyDocs\ISAPI16\05Microsoft.SharePoint.Client.Runtime.dll",
"$MyDocs\ISAPI16\02Microsoft.SharePoint.Client.Publishing.dll",
"$MyDocs\ISAPI16\04Microsoft.SharePoint.Client.Taxonomy.dll",
"$MyDocs\ISAPI16\31Microsoft.SharePoint.Security.dll",
"$MyDocs\ISAPI16\09Microsoft.SharePoint.Client.UserProfiles.dll")'

and with single backticks after each line (edit: as Quotes are designated by backticks, they've been stripped from this code entry, but they were there, and produce the same result
$MyDocs = [environment]::getfolderpath("mydocuments")

$Dlls = ("$MyDocs\ISAPI16\05Microsoft.SharePoint.Client.Runtime.dll",
"$MyDocs\ISAPI16\02Microsoft.SharePoint.Client.Publishing.dll", "$MyDocs\ISAPI16\04Microsoft.SharePoint.Client.Taxonomy.dll",
"$MyDocs\ISAPI16\31Microsoft.SharePoint.Security.dll",`
"$MyDocs\ISAPI16\09Microsoft.SharePoint.Client.UserProfiles.dll")'

Expected behavior

In my regular PowerShell console and in SharePoint Online Management Console it assigns a variable with a collection of paths, which can be iterated through with foreach.

Actual behavior

Interpreted as a series of incomplete commands, 1 per line.

Line breaking bug

Can of course be mitigated by replacing all commands broken over multiple lines with the same commands on a single line, so not P0, but fairly annoying, as I have quite a few, including a giant if() statement

Tags

#PowerShell

@ghost ghost added Needs-Triage It's a new issue that the core contributor team needs to triage at the next triage meeting Needs-Tag-Fix Doesn't match tag requirements labels Nov 4, 2019
@DHowett-MSFT
Copy link
Contributor

/dup #1091

@ghost
Copy link

ghost commented Nov 4, 2019

Hi! We've identified this issue as a duplicate of another one that already exists on this Issue Tracker. This specific instance is being closed in favor of tracking the concern over on the referenced thread. Thanks for your report!

@ghost ghost closed this as completed Nov 4, 2019
@ghost ghost added Resolution-Duplicate There's another issue on the tracker that's pretty much the same thing. and removed Needs-Triage It's a new issue that the core contributor team needs to triage at the next triage meeting Needs-Tag-Fix Doesn't match tag requirements labels Nov 4, 2019
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Resolution-Duplicate There's another issue on the tracker that's pretty much the same thing.
Projects
None yet
Development

No branches or pull requests

2 participants