Product, version and build: PowerShell Studio 2019 5.6.156.0
32 or 64 bit version of product: 64 bit
Operating system: Windows 10
32 or 64 bit OS: 64 bit
I have a GUI app that uses a here-string to format output to a text file. After installing PowerShell Studio 2019, this is no longer working. The text file outputs the data without the format I've set with the here-string. It seems to be ignoring line feeds. However, it works fine if I run it from the PowerShell Studio IDE. Problem only occurs when I convert to an EXE or I install via a MSI.
The formating still works fine in the PowerShell Studio 2018 version of the app.
Please advise. Thanks.
Here-String not working PowerShell Studio 2019
Forum rules
DO NOT POST LICENSE NUMBERS, ACTIVATION KEYS OR ANY OTHER LICENSING INFORMATION IN THIS FORUM.
Only the original author and our tech personnel can reply to a topic that is created in this forum. If you find a topic that relates to an issue you are having, please create a new topic and reference the other in your post.
Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
DO NOT POST LICENSE NUMBERS, ACTIVATION KEYS OR ANY OTHER LICENSING INFORMATION IN THIS FORUM.
Only the original author and our tech personnel can reply to a topic that is created in this forum. If you find a topic that relates to an issue you are having, please create a new topic and reference the other in your post.
Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
- theotherkidd
- Posts: 21
- Last visit: Wed May 05, 2021 2:24 pm
Re: Here-String not working PowerShell Studio 2019
In order to investigate, please zip the psf or project and upload it here:
https://www.sapien.com/support/upload
Be sure to include the psbuild file so we know what settings you are using.
Also, please include the text files for before and after the update (if possible).
https://www.sapien.com/support/upload
Be sure to include the psbuild file so we know what settings you are using.
Also, please include the text files for before and after the update (if possible).
David
SAPIEN Technologies, Inc.
SAPIEN Technologies, Inc.
- theotherkidd
- Posts: 21
- Last visit: Wed May 05, 2021 2:24 pm
Re: Here-String not working PowerShell Studio 2019
Hey David,
I was able to work around the issue. I changed the code to open the output file in notepad++ instead of notepad and the formatting is correct. Not sure why the formatting is off in notepad now since I upgraded. On an interesting note, if I cut and paste the incorrectly formatted text from notepad to notepad++ or even to a UNIX file, the data is pasted in with the right format. I'm fine with using notepad++.
Correct format:
1,SERVER01
2,SERVER01
3,1.1.1.1
1,SERVER02
2,SERVER02
3,1.1.1.2
1,SERVER03
2,SERVER03
3,1.1.1.3
Incorrect format:
1,SERVER01,2,SERVER01,3,1.1.1.1
1,SERVER02,2,SERVER02,3,1.1.1.2
1,SERVER03,2,SERVER03,3,1.1.1.3
Thanks for your response
I was able to work around the issue. I changed the code to open the output file in notepad++ instead of notepad and the formatting is correct. Not sure why the formatting is off in notepad now since I upgraded. On an interesting note, if I cut and paste the incorrectly formatted text from notepad to notepad++ or even to a UNIX file, the data is pasted in with the right format. I'm fine with using notepad++.
Correct format:
1,SERVER01
2,SERVER01
3,1.1.1.1
1,SERVER02
2,SERVER02
3,1.1.1.2
1,SERVER03
2,SERVER03
3,1.1.1.3
Incorrect format:
1,SERVER01,2,SERVER01,3,1.1.1.1
1,SERVER02,2,SERVER02,3,1.1.1.2
1,SERVER03,2,SERVER03,3,1.1.1.3
Thanks for your response
Re: Here-String not working PowerShell Studio 2019
This sounds like a line ending issue. Usually Notepad expects CRLF (`r`n) line endings and if it is just LF (`n) it will show the text all on the same line.
David
SAPIEN Technologies, Inc.
SAPIEN Technologies, Inc.
- mxtrinidad
- Posts: 399
- Last visit: Tue May 16, 2023 6:52 am
Re: Here-String not working PowerShell Studio 2019
In your example, you are missing how are you storing the values in the here-string.
Are you using single or double quotes? How are you displaying the values?
It's important to provide some kind of sample code to reproduce the issue you're experiencing.
This will help greatly.
Are you using single or double quotes? How are you displaying the values?
It's important to provide some kind of sample code to reproduce the issue you're experiencing.
This will help greatly.
- theotherkidd
- Posts: 21
- Last visit: Wed May 05, 2021 2:24 pm
Re: Here-String not working PowerShell Studio 2019
Here's gnerally what I have:
- @"
- 1,$Server
- 2,$ServerLoc
- 3,$IPAddress
- "@ | Out-File $outputFile -Encoding ASCII -Append
- mxtrinidad
- Posts: 399
- Last visit: Tue May 16, 2023 6:52 am
Re: Here-String not working PowerShell Studio 2019
This is Great!
Thanks for providing the sample code. We'll be doing some test and get back to you soon.
Thanks for providing the sample code. We'll be doing some test and get back to you soon.