rabbitR
Cyber Info3mo ago
4 replies
rabbit

Powershell 7 function issue

trying to make my first PWSH profile and am working on functions and alias, trying to figure out why one I created isn't working...

I am trying to use notepad++ instead of notepad, I copied what I believe is notepads function I found online it reads

function open.txt {
param (
[string]$FilePath )
Start-Process notepad++.exe -ArgumentList $FilePath }

replace open.txt with notepad for original text

when i open terminal in a folder that has a text file it works fine but when i use the cmd

open.txt $PROFILE.AllUsersAllHosts

I get
Cannot open file

"C\Users\Admin\Desktop\Files\Powershell\7\profile.ps1|" cannot be opened:
Folder "C\Users\Admin\Desktop\Files\Powershell\7\profile.ps1|" doesn't exist.

and it opens notepad++ with a file labeled C:\Program

yet cmd
"notepad $PROFILE.AllUsersAllHosts"
opens it just fine
Was this page helpful?