0

All I need is --for this working batch-file to run at a specific time; using 'Task Scheduler'. The PATH of the batch-file is added to the system.

The batch-file of choice works great (manually), both from cmd.exe or 'Windows File Explorer', but from 'Task Scheduler' is having an issue. In-fact, I'm not able to get correct results from the script --regardless if 'Task Scheduler' auto runs at the specified time or, if I manually 'On-Demand' start the batch-file from within the 'Task Scheduler'

There are no spaces in the file names that the script is processing.

@echo off
Setlocal EnableDelayedExpansion

for /F %%i in ('dir /B *.mkv') do ( @echo "%%i")

PAUSE

--The results when run from 'Task Scheduler':

File Not Found

Press any key to continue ...

--The results when manually typed on the cmd.exe cli, also when executed by from 'Windows Explorer' = will output every .mkv in the specified directory.

Below are images of what I configured 'Task Scheduler' to do.

General

Triggers

Actions

Actions

Settings

query-01
  • 11
  • 4
  • Is `X:` a network drive or a local drive? -if it's a network drive, the Task Scheduler context may not have it mapped. You could try using the longer network share style path `\\server\share\TEMP_TESTING\cln.bat` – GregHNZ Mar 28 '23 at 04:48
  • Please read [What must be taken into account on executing a batch file as scheduled task?](https://stackoverflow.com/a/41821620/3074564) – Mofi Mar 28 '23 at 06:25
  • @Mofi, :-) very good; thank you! Just prior to reading\skimming through the link you provided, I did figure-out the number two bullet-point, within that post. However, it wasn't until reading the post, that I had a clue --why when running the script via 'Task Scheduler', said script was not processing the files within the same sub-dir as the script itself. Additionally, I'll be playing with c and wscript, items I never knew existed – query-01 Mar 28 '23 at 22:54

0 Answers0