All Questions
Tagged with powershell string
1,087
questions
4
votes
3
answers
98
views
Create a string synopsis
Given a unknown string with an unknown size, e.g. a ScriptBlock expression or something like:
$Text = @'
LOREM IPSUM
Lorem Ipsum is simply dummy text of the printing and typesetting industry.
Lorem ...
2
votes
0
answers
56
views
How does a string unexpectedly become an array?
In one of my script I have the following problem: assigning to a string variable the result of a function makes the string an array. Example:
---------- (function edited for clarity)
$x=""
...
2
votes
2
answers
68
views
How to pass PowerShell string parameter that has both `(backtick), ' and " inside?
I am executing a Python script using a PowerShell command, The Python script takes a string that could contain special characters inside it. This parameter is passed from an ansible pipeline. The ...
2
votes
4
answers
112
views
Splitting a string on spaces but ignore section between double or single quotes
I need to split an input string at contiguous spaces into a list of strings. The input may include single or double quoted strings, which must be ignored.
How can I split a string at the spaces, but ...
0
votes
3
answers
50
views
Replace an embedded unix-style LF
I have a text file with a line feed in the middle of one of the values. In Notepad++, when showing all characters, this is what the file looks like.
text file with line feeds shown
Row1-Col1,Row1-Col2,...
-3
votes
1
answer
37
views
Can anyone tell me why this is returning as a string? PWSH
I'm trying to make an array of strings in PowerShell script. I don't understand why it keeps returning as one long string and the $var.gettype() returns string.
I tried following all of the array ...
0
votes
2
answers
64
views
Comparison between two strings is not working
I've got a problem with a comparison between two Versions.
PS C:\Windows\system32> $soft.DisplayVersion -lt "124.0"
False
I expect it to return True because the value of $soft....
0
votes
0
answers
34
views
Send string from webapp to PowerShell
I try to send from my webapp to Powershell command as follow command
.\send-message.ps1 -filename "CurrentUnloadingPlaning20240320142613833.json" -queuePath "FormatName:DIRECT=OS:GTH-...
1
vote
1
answer
62
views
Trying to import csv string value, with variable within string? [duplicate]
I'm a bit stuck trying to use param values in a string, imported from within a CSV.
I've tried a few methods, and can't seem to enumerate the parameter within the string.
First of all I have a csv ...
0
votes
2
answers
50
views
How to replace last occurrence of double quotes in a string - PowerShell
How to replace last occurrence of double quotes (") with KKK in PowerShell?
INPUT
"ABCD"|"EFGH"|"IJK" "|"LMNO"|"PQRST"|"WXYZ"
...
0
votes
1
answer
60
views
powershell - how to convert item in list to string?
I would like to replace variable $drive as 'D'. but it seems looks like that doesn't recognize 'D' as it is but something other format. when I run code, it shows blank only. Could you please check ...
0
votes
0
answers
42
views
Have to execute .Replace twice to replace text in pipe-delimited file using PowerShell
I have a PowerShell script that looks in a folder for one or more pipe-delimited HL7 files, combines them into a single file, strips out some unnecessary lines, then delivers the file to an inventory ...
1
vote
1
answer
45
views
Powershell: Specific string is not removed from file when the file only contains this specific string
I am trying to remove the following string from a batch of files: "Changed database context to 'SystemLog'." by using the script below. This will work for files that contain other ...
0
votes
2
answers
66
views
Search and modify certain strings in folder and subfolders with certain conditions with Powershell
i allready have a code that does serval things i want, but not everything i want.
I would be glad if someone could help me to complete the code to my prefs :)
What i already have, is a code that ...
0
votes
4
answers
104
views
Powershell: Removing curly quotes in directory name
This ought to be pretty straight forward, but I can't figure out why it isn't working. I am trying to replace curly quotes (’,“,”) with regular quotes (',"). The quotes that are in directory ...