Quantcast
Channel: Active questions tagged windows - Super User
Viewing all articles
Browse latest Browse all 9637

How to set a folder name into a variable to use it in the same Batch file?

$
0
0

i want to make a batch file, This Batch file must look out, into a folder with the name "Draft" and for every sub-folder will be make a search for a .txt file "list.txt" and when finds this .txt file, Then will be execute a copy from the folder "Draft" to the folder "Ready". I have written a small script but i have some issues.

@echo off:loop  for /d %%i in ('dir "C:\Users\ntosis\Desktop\Draft" /ad /o:d /s /b') do (   SET a=%%i  echo %a%  )echo Folder is empty or does not existtimeout /t 15goto loop

The problem in this small part of the script is that, the variable "a" cannot save the name of the folder, if i change the echo %a% to echo Hello World then the script prints only one time the message and not as long as the loop runs. Any ideas?


Viewing all articles
Browse latest Browse all 9637

Trending Articles