0

I am new to this but I was trying to make a batch file that would copy name of the executable file in specific location , create a new folder, give it same name as file , copy the executable file in that folder and run it.

I got all this worked out but I have more than one .exe files and I was wondering how to carry out all these iterations for all the files in the location

1 Answer 1

2

You can use for to iterate over files:

for %%F in (*.exe) do (
  mkdir "C:\Foo\%%~nF"
  copy "%%F" "C:\Foo\%%~nF"
  "C:\Foo\%%F"
)
Sign up to request clarification or add additional context in comments.

3 Comments

@user1452157 If this fully answers your question, please accept it.
Joey, thanks it worked really well , ia had one more question in that, how can we calculate execution time in that program that can be displayed at the end of the execution, please help - thank you once again
Ask a separate question for that.

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.