I could really so with some help please.
I'm trying to run a command where I wish to display the current foldername in a text file (this works fine using a command of echo %cd%)
In my parent folder I have over 500 sub folders, so I wish to run this command in each folder and display the answer in a text file in each folder and call it File2.txt, so far I have the following
for /d %%a in (C:\Test\*.*) do echo %cd% >File2.txt
However rather than creating the 500 File2 text files in the folders containing the foldernames I have 1 File2.txt file created in the parent directory (C:\Test\) which displays C:\Test\
Also, I'm not sure if its possible but would it be ok to only display the foldername in the textfile and not the full path so textfile would contain Example1 rather than C:\Test\Example1
Many thanks for your help.