0

I have a PowerShell script which works fine and when triggered via a batch file as well, I am able to get it executed. But when I try to run the same batch file via Task Scheduler, it fails stating that PowerShell is unrecognized

Below is the proper error message -

 'Powershell.exe' is not recognized as an internal or external command, operable program or batch file.

I searched for my PowerShell installation folder, but I couldn't find any path and couldn't use it. Any help would be of great help

Dileep
  • 126
  • 1
  • 4
  • 14
  • `powershell.exe` is normally in the system's PATH, in which case you can invoke it by name only. Shmukko's answer shows you the standard locations. Note that if you do have interactive access to PowerShell, you can ask for its installation folder with `$PSHome` and get the full path of the executable with `(Get-Process -Id $PID).Path` (this may be helpful in PowerShell _Core_, whose installation location may vary and whose executable filename is different). – mklement0 Mar 20 '19 at 10:47

1 Answers1

1

The Path to Powershell.exe is:

C:\Windows\System32\WindowsPowershell\v1.0

32bit Version on 64bit-Systems:

C:\Windows\SysWOW64\WindowsPowerShell\v1.0
Shmukko
  • 572
  • 3
  • 11