Skip to content

Instantly share code, notes, and snippets.

@bferg314
Created August 16, 2017 18:29
Show Gist options
  • Save bferg314/bbf04e5ecaafce9ab11ae35ec9bb4718 to your computer and use it in GitHub Desktop.
Save bferg314/bbf04e5ecaafce9ab11ae35ec9bb4718 to your computer and use it in GitHub Desktop.
Sets proxy for current session on windows, great for pip!
@echo off
set "psCommand=powershell -Command "$pword = read-host 'Enter Password for %username%' -AsSecureString ; ^
$BSTR=[System.Runtime.InteropServices.Marshal]::SecureStringToBSTR($pword); ^
[System.Runtime.InteropServices.Marshal]::PtrToStringAuto($BSTR)""
for /f "usebackq delims=" %%p in (`%psCommand%`) do set password=%%p
set HTTP_PROXY=http://%username%:%password%@proxy.company.com:1234
set HTTPS_PROXY=https://%username%:%password%@proxy.company.com:1234
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment