I am trying to run some NuGet commands through a PowerShell script, but PowerShell prompts errors like: "Unknown command:'-set'" or "Unexpected token '-set' in expression or statement"
I'm trying to run the following NuGet commands:
$nugetExe = "C:\TestAutomation\NuGet\nuget.exe"
Invoke-Expression "$nugetExe config -set http_proxy.user= txxxxxx"
Invoke-Expression "$nugetExe config -set http_proxy.password= njhbjhb"
PS.: The PowerShell version is 5.1 and NuGet is 4.6.**This code works fine through Windows CMD.
On the CMD command line I run it like this, and it works:
nuget.exe config -set http_proxy.user=txxxxxx
nuget.exe config -set http_proxy.password= njhbjhb