Skip to content

Instantly share code, notes, and snippets.

@tmclnk
Last active August 29, 2015 14:22
Show Gist options
  • Save tmclnk/fd4e5c07ed5933b694b7 to your computer and use it in GitHub Desktop.
Save tmclnk/fd4e5c07ed5933b694b7 to your computer and use it in GitHub Desktop.
Windows Batch File to set Proxy Server in Grails 2.x
@echo off
REM USE THIS FILE IF YOU HAVE GRAILS CONFIGURED
set "psCommand=powershell -Command "$pword = read-host 'Enter Password' -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
grails add-proxy myproxy "--host=proxy_server" "--port=8020" "--username=%USERNAME%" "--password=%password%"
grails use-proxy myproxy
@echo off
REM USE THIS FILE IF YOU WISH TO INCLUDE IN A GRAILS 2.x PROJECT WITH GRAILSW
set "psCommand=powershell -Command "$pword = read-host 'Enter Password' -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
grailsw add-proxy myproxy "--host=proxy_server" "--port=8020" "--username=%USERNAME%" "--password=%password%"
grailsw use-proxy myproxy
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment