I am calling a powershell script from a batch file, both in different locations.
I would like to pass the folder location for the powershell script file as well as the parameter, a user entered string in the batch file, from that batch file.
powershell script:
$url = "https://www.ons.gov.uk/generator?format=csv&uri=/economy/inflationandpriceindices/timeseries/chaw/mm23"
$output="sample.csv"
$start_time = Get-Date
$arg1=$args[0]
Invoke-WebRequest -Uri $url -OutFile $arg1\$output
Write-Output "Time taken: $((Get-Date).Subtract($start_time).Seconds) second(s)"
My Batch file :
powershell.exe -ExecutionPolicy Bypass -file C:\temp\download-rpi.ps1 "\\drives\savehere"