Skip to content

Commit

Permalink
Place strings in quotes (#146)
Browse files Browse the repository at this point in the history
  • Loading branch information
simonkurtz-MSFT authored Nov 21, 2023
1 parent 9d322cd commit ca6423a
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions docs/aca/13-appendix/Set-Variables.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,12 @@ foreach ($var in $vars) {

if (Test-Path variable:$var) {
$val = Get-Variable -Name $var -ValueOnly

# Powershell 7.4.0 requires a bit more type safety by setting quotes around strings.
if ($val.GetType().Name -eq "String") {
$val = "`"$val`""
}

"Set-Variable -Scope Global -Name $var -Value $val" | Out-File -FilePath $file -Append
$i++
}
Expand Down

0 comments on commit ca6423a

Please sign in to comment.