Can you pass in variables to a Python environment?

Can you pass in variables to a Python environment?

avatar
Product: PowerShell Universal
Version: 1.4.6


I thought I recall reading somewhere that there is a way to do it but I can’t seem to find it. Is there a way? We have python script executing and that works fine but It would be nice to be able to pass in arguments. So is there a way?

All Comments (3)

avatar

I don’t get how this is related to PSU, but here is how I call a python script with a parameter and retrieve back output

$olevba=iex "& python C:\Python37\Lib\site-packages\oletools\olevba.py --relaxed -t $tempfile 2>''" -ErrorVariable stderr


avatar

PSU actually supports running python scripts natively if you create a python environment to run the scripts in. This is helpful for scheduling and consolidating both Powershell and python scripts in one place. It doesn’t have as many features as ps though.

avatar

Oh, I didn’t try that yet.
Thanks.