Scripts to move config out of home directory
This commit is contained in:
parent
5f2a27f9b8
commit
9a30a349fb
2 changed files with 24 additions and 0 deletions
1
setup.cmd
Normal file
1
setup.cmd
Normal file
|
|
@ -0,0 +1 @@
|
|||
@powershell -ExecutionPolicy unrestricted %~dp0setup.ps1
|
||||
23
setup.ps1
Normal file
23
setup.ps1
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
function new-link($link, $target) {
|
||||
if (test-path $target -PathType Container) {
|
||||
cmd /c mklink /j $link $target
|
||||
} else {
|
||||
cmd /c mklink /h $link $target
|
||||
}
|
||||
}
|
||||
|
||||
$ignore = @(".gitignore", "setup.ps1")
|
||||
|
||||
Get-ChildItem . |
|
||||
? { !$ignore.Contains($_.Name) } |
|
||||
% {
|
||||
$l = split-path -leaf $_.FullName
|
||||
$p = split-path -parent (split-path -parent $_.FullName)
|
||||
$t = join-path $p $l
|
||||
|
||||
if (test-path $t) {
|
||||
remove-item -recurse -force $t
|
||||
}
|
||||
|
||||
new-link $t $($_.FullName)
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue