PowerShell-Profile/functions/Find-Notepadpp.ps1
Tomasz Kostrzewa f31a592d00 modified: RdzeN-Profile.ps1
modified:   functions/Find-Notepadpp.ps1
	modified:   functions/Find-VSCode.ps1
	new file:   functions/Open-Folder.ps1
2024-03-06 00:25:22 +01: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
}
}