Linked Questions
30 questions linked to/from PowerShell 7.3.0 breaking command invocation
20 votes
6 answers
25k views
Powershell: passing json string to curl
I'm trying to pass a JSON string from within a powershell script to the build.phonegap.com api, using curl. According to phonegap's forum, when running on a Windows machine, the JSON data has to be ...
16 votes
3 answers
12k views
'kubectl patch' works on Linux Bash but not in Windows Powershell ISE
The following command works fine on Ubuntu bash: kubectl patch deployment wapi-backend-d1 --patch '{"spec": {"template": {"metadata": {"labels": {"date": "test"}}}}}' The same command does not work ...
17 votes
1 answer
15k views
Why does invoke operator (&) and Invoke-Expression produce different results for the same input?
From my understanding, the invoke operator (&) and the Invoke-Expression cmdlet should behave similar. However, as can be seen below, this is not the case: PS C:\Users\admin> powershell -...
7 votes
3 answers
5k views
pwsh -Command is removing quotation marks
In pwsh call the following: Write-Host '{"drop_attr": "name"}' Result ok: {"drop_attr": "name"} Now do the same via pwsh: pwsh -Command Write-Host '{"drop_attr": "name"}' Result is missing ...
5 votes
2 answers
17k views
Powershell & Curl - Using variables inside single-quoted JSON body
I am currently trying to automate new user creation in our Zendesk ticketing system using Powershell and Curl. The problem I am running into is that the curl json body is enclosed by single quotes ...
1 vote
2 answers
2k views
Powershell is eating quotes in a GitHub action
I have this line in a GitHub Action: curl https://api.github.com/repos/JJ/raku-advent-calendar-article-2019/issues/$ENV:ISSUE/comments -H "Authorization: token $ENV:TOKEN" -H "Content-Type: ...
3 votes
1 answer
3k views
Setting Public Property Values on the Command Line
Setting Public Property Values on the Command Line of an msi follows the pattern MyInstaller.msi PUBLICPROPERTY="someValue" This works on "Command Prompt" aka cmd.exe and powershell. But ...
4 votes
2 answers
1k views
How to run multiple commands within git submodule foreach?
What I have tried git submodule foreach git checkout main git submodule foreach git add --all git submodule foreach git diff-index --quiet HEAD || git commit -m "%CommitMessage%" git ...
1 vote
1 answer
4k views
How can use a PowerShell script to run the Terraform CLI and pass a variable of type map?
The variable in the Terraform file (infrastructure.tf) is declared like this: variable "tags" { type = map(string) } This is the PowerShell code that executes the terraform command-line ...
4 votes
1 answer
2k views
PowerShell: escaping rules for CLI calls
As I have learned, when invoking PowerShell from cmd.exe, with the -Command option, escaping rules are essentially those used in Linux. So you use a backslash (\), rather than the usual backtick (`). ...
2 votes
3 answers
996 views
What is the recommended way of calling external commands in PowerShell including error handling?
I would like to call external commands from PowerShell Core such as Git, Python or other proprietary executables, but I want the call to throw when the exit code is non-zero while respecting ...
1 vote
2 answers
550 views
Pass a JSON string without using backslashes
Using backslashes to pass a JSON string as a parameter in PowerShell is cumbersome. executable --json-input '{ \"name\": \"Bob\" }' output.txt Is there a way to avoid using these ...
3 votes
1 answer
627 views
Python argparse not working corrrectly with path in Windows
The argparse library in python doesn't work for any path containing a space and \ (backslash) at the end. The parser will parse the backslash at the end of path to be " (double quotation). The ...
1 vote
1 answer
1k views
How to add quotation marks on a value on registry?
How do I add into the registry in which the value of the UninstallString needs to have quotation marks at the beginning and end. HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\...
1 vote
2 answers
443 views
PowerShell removes multiple consecutive whitespaces when I pass arguments to a nested Start-Process command
This powershell code works fine: powershell -NoProfile -Command {Start-Process -FilePath wscript.exe -Verb RunAs -ArgumentList '"C:\Users\TestAccount\Desktop\cartella con spazi\test.vbs" &...