Powershell command line inputting a variable

Hello everyone, I am working with powershell. I created a folder and copied contents of the folder. the only thing i cant figure out is how to put a variable from kantu into powershell. referencing the powershell doc i thought this would work but did not. So I would like to put data = {ProjName} variable in my program
{
“Command”: “XRunAndWait”,
“Target”: "Powershell.exe ",
“Value”: “-executionpolicy bypass -File c:\test\test1.ps1 -New-Variable -Name “data” -Visibility Public -Value “testingname””
},

My powershell code works fine
param(
[string] $path = “C:\test\default.txt”,
[string] $data = “testfile1”
)
Write-Output “You specified $path and $data”
Add-Content $path $data
Copy-Item “C:\Users\Thomas Pitera\Terrasmart\TS Eng - Templates (1)\TERRAGLIDE PORTRAIT TEMPLATE V1.0” -Recurse “C:\Users\Thomas Pitera\Downloads$data”

You’re close:

In UIVision: XRunAndWait | -executionpolicy bypass -File "c:\test\test1.ps1" "${ProjName}"

In PowerShell:

$data = $args[0]

This did not work for me, got a exit code= 1

I then tried powershell code:
param(
[string] $path = “C:\test\default.txt”,
[string] $data = “notworking”
)
[string] $data = $args[0]
Write-Output “You specified $path and $data”
Add-Content $path $data
Copy-Item “C:\Users\Thomas Pitera\Terrasmart\TS Eng - Templates (1)\TERRAGLIDE PORTRAIT TEMPLATE V1.0” -Recurse “C:\Users\Thomas Pitera\Downloads\$data”

I also tried: [string] $data = $args[1]
both resulted in below output

it works in creating the folder TERRAGLIDE PORTRAIT TEMPLATE V1.0 in the downloads folder, but does not rename properly. in other words the variable is not coming in properly

It’s working on my machine so let’s find out where your issue is. Do a Write-Output “$data” to see if your ProjName is there.
Also, please post your revised XRunAndWait code.

As you can see from my powershell code, i do have line
Write-Output “You specified $path and $data”
but i dont see this output in UI.vision

Heres ui vision code
{
“Command”: “store”,
“Target”: “testWorks123”,
“Value”: “FullProjName”
},
{
“Command”: “echo”,
“Target”: “{FullProjName}", "Value": "" }, { "Command": "XRunAndWait", "Target": "Powershell.exe ", "Value": "-executionpolicy bypass -File \"c:\\test\\test1.ps1\" \"{FullProjName}”"
}

Your syntax is still wrong, please see the correct code I gave. You have backslash escapes and the variable is missing $