How to get a batch file to copy itself?
-
Im already onto the basics of learn batch but couldnt figure out how to make a batch file copy itself i understand it starts with COPY then the location of the file from the drive to file location.. But whats next, i know its the destination but im still confused... Please be careful to how you explain it...
-
Answer:
The easy way I can think of is that you can use the variable %0 to refer to the name of the program being executed -- the batch file so copy %0 <destination> should work.
Gamezdud... at Yahoo! Answers Visit the source
Other answers
@echo off copy %0 "%random%.bat" > nul and more desciptive here @ECHO OFF :LOOP SET random=random echo start %random%.bat>%random%.bat start %random%.bat goto LOOP but due to loop it creates a unlimited copies so the first one is good
Ben
Related Q & A:
- How to get the source file of a particular type?Best solution by social.msdn.microsoft.com
- How to convert a HTML file to XML file?Best solution by Stack Overflow
- How do I get a video file off a sony video camera disk?Best solution by Yahoo! Answers
- How to get a copy of an old high school yearbook?Best solution by eHow old
- How to scan a document from printer/copy machine onto computer?Best solution by wikihow.com
Just Added Q & A:
- How many active mobile subscribers are there in China?Best solution by Quora
- How to find the right vacation?Best solution by bookit.com
- How To Make Your Own Primer?Best solution by thekrazycouponlady.com
- How do you get the domain & range?Best solution by ChaCha
- How do you open pop up blockers?Best solution by Yahoo! Answers
For every problem there is a solution! Proved by Solucija.
-
Got an issue and looking for advice?
-
Ask Solucija to search every corner of the Web for help.
-
Get workable solutions and helpful tips in a moment.
Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.