Command failed (Substitution failed while writing file) createfile until END_OF_FILE

with saving as PowerShell its working but need a solution for action script

// Disable wow64 redirection on x64 OSes
action uses wow64 redirection {not x64 of operating system}

waithidden cmd.exe /c mkdir c:\scripts\

delete __createfile

// CREATEFILE
createfile until END_OF_FILE
#software Name
$software = “Microsoft.HEIFImageExtension
$ver = “1.0.43012.0”
$App = Get-AppxPackage $software -AllUsers
"Store APP Action Initiated at $([datetime]::Now)" | Out-File -FilePath “C:\Temp\MS_Store_Log.txt”
"------------------------------------------------"| Out-File -FilePath “C:\Temp\MS_Store_Log.txt” -Append
if ($App -ne $null)
{
if ($App.Version -lt $Ver)
{
“Uninstalling application “+ $App.Name | Out-File -FilePath “C:\Temp\MS_Store_Log.txt” -Append
Get-AppxPackage -PackageTypeFilter Main, Bundle, Resource -AllUsers| Where-Object {$_.PackageFullName -like “$software”} | Remove-AppxPackage -Allusers
$a = Get-AppxPackage $software -AllUsers
if ($a -eq $null)
{
“Software has been uninstalled.” | Out-File -FilePath “C:\Temp\MS_Store_Log.txt” -Append
}
else
{
$App.Name +” || “+ $App.version +” Uninstallation Failed” | Out-File -FilePath “C:\Temp\MS_Store_Log.txt” -Append
}
}
else
{
$App.Name +" || “+ $App.version +” Higher Version Already Present" | Out-File -FilePath “C:\Temp\MS_Store_Log.txt” -Append
}
}
Else
{
$software +" Software is not present." | Out-File -FilePath “C:\Temp\MS_Store_Log.txt” -Append
}
END_OF_FILE

delete delete c:\scripts\MicrosoftHEIFImageExtension.ps1
copy __createfile c:\scripts\MicrosoftHEIFImageExtension.ps1

waithidden { pathname of file ((it as string) of value “Path” of key “HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\PowerShell\1\ShellIds\Microsoft.PowerShell” of native registry) } -ExecutionPolicy Bypass -File MicrosoftHEIFImageExtension.ps1

See Tip: Escaping curly brackets for substitutions in ActionScript

In the PowerShell script, in any place you need a literal “{” that should not be a relevance substitution, escape it as “{{”

2 Likes