Windows .bat create folders then delete .bat file

by Max-Enrik   Last Updated June 23, 2018 16:01 PM

How can I write command line for creates many folders then that .bat file will delete automatically, please?



Answers 2


Why would you do something like that? If you only use the command for creating the folders once, you could just do it via cmd.

you could determine bat file location with %0 and delete it- but it's not wise to delete a script were the reason to write it is to use it multiple times…

kai-dj
kai-dj
June 23, 2018 15:29 PM

After creating all folders execute "DEL %~f0" at end of batch file. %~f0 will expand to full path of current batch file. This will delete batch file after execution.

Sandeep
Sandeep
June 23, 2018 15:38 PM

Related Questions





Execute .bat script as administrator from gpedit.msc

Updated October 28, 2017 12:01 PM

Copy all files from a list of folder locations

Updated June 16, 2015 05:00 AM