-1

I've tried running this .bat file by just double clicking it, and it works. However when I try to run it through Task Scheduler:

CD /D %~dp0
@echo on

python -W ignore DailyRates.py

PAUSE

I get the classic

C:\Windows\system32>CD /D U:\

U:\>python -W ignore DailyRates.py
'python' is not recognized as an internal or external command,
operable program or batch file.

U:\>PAUSE
Press any key to continue . . .

Which means it isn't recognizing python in my PATH, but I am in the correct directory (U: drive)

David Yang
  • 2,101
  • 13
  • 28
  • 46
  • 1
    If Python is installed only for the current user, it's probably in the per-user `PATH` in `HKCU\Environment` instead of the system `PATH`. In this case it should only work if you're running the batch file as the same user. – Eryk Sun Jun 30 '17 at 20:55
  • See the answers on [Executing BAT files in scheduled task](https://stackoverflow.com/a/41821620/3074564) and [What is the reason for 'sort' is not recognized as an internal or external command, operable program or batch file?](https://stackoverflow.com/a/41461002/3074564) – Mofi Jul 01 '17 at 15:33

1 Answers1

0

For anyone curious, I ended up using the explicit path instead of trying to simply call python.

C:\Users\...\...\...\...\...\python.exe -W ignore U:\Sandbox\DailyRates.py
David Yang
  • 2,101
  • 13
  • 28
  • 46