bookie32 Posted March 26, 2019 Share Posted March 26, 2019 Hi guys! Instead of creating a batch file... How do I create several files with differnt names at once....seen many how to's for directories but not actual documents? bookie32 Link to comment Share on other sites More sharing options...
jaclaz Posted March 26, 2019 Share Posted March 26, 2019 1 hour ago, bookie32 said: Hi guys! Instead of creating a batch file... How do I create several files with differnt names at once....seen many how to's for directories but not actual documents? bookie32 What do you mean? "Random" files? https://www.digitalcitizen.life/3-ways-create-random-dummy-files-windows-given-size or http://www.bertel.de/software/rdfc/index-en.html jaclaz Link to comment Share on other sites More sharing options...
bookie32 Posted March 26, 2019 Author Share Posted March 26, 2019 Hi jaclaz Yes...that can work..... I was thinking on the lines of: dir > text.txt text1.txt text2.txt I just wondered how I could create several documents at once with just one line of code... bookie32 Link to comment Share on other sites More sharing options...
jaclaz Posted March 26, 2019 Share Posted March 26, 2019 I will try again: WHAT do you want to do? You don't pay a fee per word posted, DESCRIBE in DETAIL what you need/want, otherwise you will only have people attempting to help you lose their time in guesses. A one liner that creates an arbitrary number of files (10 in this example, each containing the text "File" followed by the same progressive number that is also added to the filename) : FOR /L %? IN (1,1,10) DO ECHO File%?>text%?.txt jaclaz Link to comment Share on other sites More sharing options...
bookie32 Posted March 26, 2019 Author Share Posted March 26, 2019 OK not following: I cannot write the code as shown: dir > text.txt text1.txt text2.txt instead of writing: dir > text.txt and then: dir > text1.txt And so on...how do I write one line of code that creates all three files? bookie32 Link to comment Share on other sites More sharing options...
jaclaz Posted March 26, 2019 Share Posted March 26, 2019 58 minutes ago, bookie32 said: OK not following: I cannot write the code as shown: No. (You can actually "write the code as shown" but the result upon execution won't be three files). 1 hour ago, bookie32 said: And so on...how do I write one line of code that creates all three files? You can use a FOR /L loop, as shown. Or, if you literally want three files called text.txt, text1.txt and text2.txt, all of them with the same content, the output of the command DIR: dir>text.txt&dir>text1.txt&dir>text2.txt almost the same result: FOR /L %? IN (0,1,2) DO DIR>text%?.txt actually the same result: DIR>text.txt&FOR /L %? IN (1,1,2) DO COPY text.txt text%?.txt jaclaz Link to comment Share on other sites More sharing options...
hotnuma Posted March 26, 2019 Share Posted March 26, 2019 Or maybe like this : dir > text.txt & copy /y text.txt text1.txt & copy /y text.txt text2.txt Link to comment Share on other sites More sharing options...
bookie32 Posted March 27, 2019 Author Share Posted March 27, 2019 Hi guys😀 Thanks for the help...😁 bookie32 Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now