echo a for into a file?
Posted: 06 Jul 2024 20:31
Hello,
This is my first post in here, the question I have is if there is a possible way to echo a for into a file.
What I am trying to do is write a whole for loop into a new file to call it sometime later. The code kinda looks like this:
This is my first post in here, the question I have is if there is a possible way to echo a for into a file.
What I am trying to do is write a whole for loop into a new file to call it sometime later. The code kinda looks like this:
The error message I get is "do was unexpected at this time", I know I could just use > to echo lines inside a file the for loop has more after the do and I thought it was easier to just write it then echo it into a file.(
echo for /f "usebackq tokens=* delims=:" %%a in (`dir C:\myfolder\withmanyfiles\`) do (echo File inside My Folder is %%a)
) > "mybatchfile.bat"