0
votes

In my config.xml file is:

<Settings>
    <Prog>notepad.exe</Prog>
</Settings>

in my PS script is:

$settings = @{
    Program = $ConfigFile.Settings.Prog
}

#try run it
& $settings.Program

WARNING: The term 'notepad.exe' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.

Why this error occurs?

1
What version of PowerShell are you using? Your exact code actually does work for me. - campbell.rw
Powershell version 4.0 - sumol

1 Answers

0
votes

Try specifying the absolute path to notepad.exe (ie. C:\Windows\System32\notepad.exe) and see if that helps.