I need a batch files the launches all files in a given folder (in this case it is c:\macros\day).
I've tried the following, but it doesn't seem to do anything.
for /f %i in ('C:\macros\Day /b') DO command %i
Open Start. Search for Command Prompt, right-click the top result, and select the Run as administrator option. Type the following command to run a Windows 10 batch file and press Enter: C:\PATH\TO\FOLDER\BATCH-NAME. bat.
%%parameter A replaceable parameter: in a batch file use %%G (on the command line %G) FOR /F processing of a text file consists of reading the file, one line of text at a time and then breaking the line up into individual items of data called 'tokens'.
Use double percent signs ( %% ) to carry out the for command within a batch file. Variables are case sensitive, and they must be represented with an alphabetical value such as %a, %b, or %c. ( <set> ) Required. Specifies one or more files, directories, or text strings, or a range of values on which to run the command.
This works from my command line:
for /F "usebackq" %%i in (`dir /b C:\macros\Day\`) DO %%i
as does this:
for %%i in (C:\macros\Day\*) do %%i
You used the incorrect variant of for
. simply do (pun intended) for %%i in (c:\macros\Day\*) do %%i
Edit:
If you need to run a command
on all files: for %%i in (c:\macros\Day\*) do command %%i
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With