Browse Source

modified path_append to handle spaces

master
school 7 years ago
parent
commit
071ea51e3a
  1. 2
      workers/pa.ps1
  2. 5
      workers/path_append.bat

2
workers/pa.ps1

@ -1,4 +1,4 @@
$newPath = $args[0]
$newPath = $args[0] -replace '"',''
echo $newPath echo $newPath
$oldPath = [Environment]::GetEnvironmentVariable('path', 'user'); $oldPath = [Environment]::GetEnvironmentVariable('path', 'user');
[Environment]::SetEnvironmentVariable('path', "$($newPath);$($oldPath)",'user'); [Environment]::SetEnvironmentVariable('path', "$($newPath);$($oldPath)",'user');

5
workers/path_append.bat

@ -1,7 +1,8 @@
@echo off @echo off
if "%1" == "help" (
if %1 == help (
echo:Usage: %0 path echo:Usage: %0 path
echo:path Path to be added to the user PATH variable echo:path Path to be added to the user PATH variable
) else ( ) else (
%windir%\System32\WindowsPowerShell\v1.0\powershell.exe -ExecutionPolicy Bypass -File %~dp0pa.ps1 %1
REM echo %~dp0pa.ps1
%windir%\System32\WindowsPowerShell\v1.0\powershell.exe -ExecutionPolicy Bypass -File %~dp0_pa.ps1 \"%1\"
) )
Loading…
Cancel
Save