Skip to content

Commit

Permalink
fixed double semicolon bug, added link to blog post.
Browse files Browse the repository at this point in the history
  • Loading branch information
peter committed Apr 15, 2017
1 parent ca9e8f8 commit 25f5ef6
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions Set-PathVariable.ps1
Expand Up @@ -46,9 +46,9 @@ Process

# build the new path, make sure we don't have double semicolons
$newPath = $oldPath + ";" + $NewLocation
$newPath = $newPath -replace ";;",""
$newPath = $newPath -replace ";;",";"

if ($pscmdlet.ShouldProcess("%Path%", "Add $NewLocation")){
if ($pscmdlet.ShouldProcess("%Path%", "Set $newPath")){
# add to the current session
$env:path += ";$NewLocation"
# save into registry
Expand All @@ -75,6 +75,6 @@ Process
Author: Peter Hahndorf
Created: October 7th, 2016
.LINK
https://peter.hahndorf.eu
https://github.com/hahndorf/hacops
https://peter.hahndorf.eu/blog/AddingToPathVariable
#>

0 comments on commit 25f5ef6

Please sign in to comment.