Skip to content

Instantly share code, notes, and snippets.

@sdluxeon
Created March 12, 2016 09:03
Show Gist options
  • Select an option

  • Save sdluxeon/f8476ffe352a919330d3 to your computer and use it in GitHub Desktop.

Select an option

Save sdluxeon/f8476ffe352a919330d3 to your computer and use it in GitHub Desktop.
use tool
@echo off
SETLOCAL
SET npm=%LocalAppData%\npm\npm.exe
CALL :use-tool node https://nodejs.org/dist/v4.4.0/win-x64/node.exe
%node%
EXIT /B 0
:use-tool
SET tool=%~1
SET url=%~2
SET toolLocation=%LocalAppData%\%tool%\%tool%.exe
if "%tool%"=="" (
echo "Tool name not set"
EXIT /B 0
)
if "%url%"=="" (
echo "Tool Url not set"
EXIT /B 0
)
echo Using %tool%
IF NOT EXIST %toolLocation% (
echo Downloading %url%
md %LocalAppData%\%tool%
@powershell -NoProfile -ExecutionPolicy unrestricted -Command "$ProgressPreference = 'SilentlyContinue'; Invoke-WebRequest '%url%' -OutFile '%toolLocation%'"
) else echo %toolLocation% already exists
set entry%tool%=%toolLocation%
EXIT /B 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment