简体   繁体   中英

Given a text file containing cmd commands, how can I use a batch file to loop and run them?

I am using a text file to store a list of cmd commands. I am using the commands to gather information about users on my domain. There are about 400 lines of text each following the format of net user someuser > someuser.txt I want to use a batch file to loop through the single text file line by line and execute the commands.

这个FOR循环应该可以解决这个问题:

 FOR /F %%c IN ('type commands.txt') DO %%c

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM