PowerShell-Profile/functions/Find-Notepadpp.ps1
2024-05-01 14:12:54 +02:00

26 lines
698 B
PowerShell

# 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
}
}