0

I want to make a script which copies some files from different locations.

I have the next folder: C:\Test\FILES\< RANDOM_NAME >\< many_files > . In this folder, I have many files which I need later.

I copy the entire directory < RANDOM_NAME > to my working directory. But later, in my script i need the exact name of < RANDOM_NAME > folder. How can i get it?

1 Answer 1

2
for /d %%a in (*) do set "folderName=%%a"

Under the assumption that the required folder is the only one inside the current directory.

The for /d will enumerate the matching (*) folders inside the current active directory and the name of the folder is assigned to the %folderName% variable.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.