Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
252 views
in Technique[技术] by (71.8m points)

windows - Batch Script to do operation on all subfolders

I have a program that does something to a folder. From the Command Prompt, I just need to type in the following to achieve what I need:

program.exe C:foldersubfolder1

However, now I need to do this for multiple subfolders in C:folder:

program.exe subfolder1
program.exe subfolder2
program.exe subfolder3
...
program.exe subfoldern

I wrote a batch script but it keeps adding %i to the end of my subfolder path.
This is what I have: for /r %%i in (%%i) do program.exe %%i

The result is almost what I want, except the %i at the end of the path

program.exe subfolder1\%i
program.exe subfolder2\%i
program.exe subfolder3\%i
...
program.exe subfoldern\%i

How do I fix this so that the \%i is not in the path of my subfolder?

question from:https://stackoverflow.com/questions/66054632/batch-script-to-do-operation-on-all-subfolders

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...