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”
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.