modified: RdzeN-Profile.ps1

new file:   functions/Find-Notepadpp.ps1
	new file:   functions/Find-VSCode.ps1
This commit is contained in:
Tomasz Kostrzewa 2024-03-05 21:34:21 +01:00
parent 7a95abaf92
commit 40bbb8e19f
3 changed files with 52 additions and 1 deletions

View File

@ -51,4 +51,3 @@ Test-Profile
Override-Profile
# 6. Reload Profile
Reload-Profile

View File

@ -0,0 +1,26 @@
# gitea.RdzeN.net
# Find notepad++
# use notepad++ as editor
function find-notepadpp {
$a = Get-ChildItem -Path $env:ProgramFiles -Filter "notepad++.exe" -Recurse -File -ErrorAction SilentlyContinue
$b = Get-ChildItem -Path ${env:ProgramFiles(x86)} -Filter "notepad++.exe" -Recurse -File -ErrorAction SilentlyContinue
if ($a -ne $null) {
$notepadpp = $a[0].FullName
} else {
$notepadpp = $b[0].FullName
}
if ($notepadpp -ne $null) {
return $notepadpp
}
}
$notepadpp = find-notepadpp
if ($notepadpp -ne $null) {
function editn {
param (
$filepath
)
Start-Process $notepadpp -ArgumentList $filepath
}
}

26
functions/Find-VSCode.ps1 Normal file
View File

@ -0,0 +1,26 @@
# gitea.RdzeN.net
# Find notepad++
# use notepad++ as editor
function find-vscode {
$a = Get-ChildItem -Path $env:ProgramFiles -Filter "Code.exe" -Recurse -File -ErrorAction SilentlyContinue
$b = Get-ChildItem -Path ${env:ProgramFiles(x86)} -Filter "Code.exe" -Recurse -File -ErrorAction SilentlyContinue
if ($a -ne $null) {
$vscode = $a[0].FullName
} else {
$vscode = $b[0].FullName
}
if ($vscode -ne $null) {
return $vscode
}
}
$vscode = find-vscode
if ($vscode -ne $null) {
function editv {
param (
$filepath
)
Start-Process $vscode -ArgumentList $filepath
}
}