dnote/windows-install.bat
Daniel Hume a7e7364332 Fix windows console colours, include installer script for windows (#73)
* partial fix of ls and add commands

* completing log changes for windows-compatible colours

* Added Windows installer batch script

* cleanup

* ran dep ensure
2018-02-17 10:53:30 +11:00

37 lines
949 B
Batchfile

@echo off
set DNOTEPATH=%PROGRAMFILES%\Dnote CLI
set DNOTEDL=dnote-windows-amd64.exe
set DNOTETARGET=%DNOTEPATH%\dnote.exe
echo Checking for directory...
if not exist "%DNOTEPATH%\" (
echo Creating directory...
mkdir "%DNOTEPATH%"
)
echo Moving program to target directory...
move /Y %DNOTEDL% "%DNOTETARGET%"
echo "Adding directory to user PATH..."
REM retrieve only the user's PATH from registry,
REM to avoid attempting (and probably failing) to overwrite the
REM system path
set Key=HKCU\Environment
FOR /F "tokens=2* skip=1" %%G IN ('REG QUERY %Key% /v PATH') DO (
echo %%H > user_path_backup.txt
set t=%%H
set "NEWPATH="
:loop
for /f "delims=; tokens=1*" %%a in ("%t%") do (
set t=%%b
if not "%%a" == "%DNOTEPATH%" (
if defined NEWPATH (
set NEWPATH=%NEWPATH%;%%a
) else (
set NEWPATH=%%a
)
)
)
if defined t goto :loop
)
set NEWPATH=%NEWPATH%;%DNOTEPATH%
setx PATH "%NEWPATH%"