2

I have this FOR LOOP that is suppose to run through all sub-folders and output a CSV file in them, however the for loop only runs through the first sub-folder> I'm new to batch scripting so I may be overlooking something rather easy but I cannot figure out my problem.

FOR LOOP:

FOR %%_ IN (
  MISAG
  MITAW
  NYAMS
  NYBIN
  WIAPP
  WIMIL) DO (
  IF NOT EXIST %LOG_DIR%\%%_\ ( MD %LOG_DIR%\%%_\ )
  echo=" here I am "
  echo=Folder is: %%_
  echo LOG_NM path and name ..... %LOG_DIR%\%%_\%LOG_NM%

  CALL test_connection_%%_.bat
)

I can add more code if that is helpful.

Compo
  • 36,585
  • 5
  • 27
  • 39
ld33
  • 21
  • 2
  • Does this answer your question? [Batch files: List all files in a directory with relative paths](https://stackoverflow.com/questions/8385454/batch-files-list-all-files-in-a-directory-with-relative-paths) – JonathanDavidArndt Dec 19 '19 at 16:44
  • I've got a [Déjà-vu](https://stackoverflow.com/questions/59398227/send-output-to-all-folders-in-for-loop) – Stephan Dec 19 '19 at 16:45
  • Also.. where is the %%G supposed to come from? – Señor CMasMas Dec 19 '19 at 16:45
  • remove the `exit`s from the `test_connection_*.bat` or replace them with `goto :eof` – Stephan Dec 19 '19 at 16:47
  • LDrizzy, why have you decided to delete [your earlier question](https://stackoverflow.com/q/59411205) and post it under this member name instead? – Compo Dec 19 '19 at 16:52
  • Can you also confirm that no file or directory can contain any spaces or other potentially poison characters anywhere within their names or paths, because there's a distinct lack of doublequotes, _(except where they're not required)_. I have also once again had to remove the [[tag:dos]] tag from your question. Please understand that DOS is an operating system, you are using Windows as yours, aren't you? – Compo Dec 19 '19 at 16:58
  • @Stephan fixed my problem. I had to go into my test_connection.bat file and remove exit from the files. – ld33 Dec 19 '19 at 17:05
  • Did you also add the password to the command, that I mentioned to you earlier, _(in the deleted question)_? Also, can you please choose one member name only, and delete all others, as you can understand one person should not generally have multiple accounts here. Please take a look at [this](https://meta.stackexchange.com/a/57685) for a little insight into why having multiple accounts could be problematic. – Compo Dec 19 '19 at 17:18

0 Answers0