Intro: How to Make Batch Files Install Any File!
Ever want to give a download on an instructable, but it has to be in the correct folder? Here's how you can make a simple installer that can create multiple files, given you created it correctly. You will need
-a Windows NT (or higher) computer
-a file you want to install
-a place to put the file
Step 1: The Most Basic of Text Editing
Before we start programming we are going to have to open notepad.
Then proceed to the next step.
Step 2: The Code
This time you have to create the code. But I will show you how. Make sure you write down the code in notepad.
Say you file has two lines that are
This is the best instructable ever!
Thanks to Super_Nerd
And you want to put it in the filepath
C:\Users\ Users name goes here\Desktop
You start the code with
Otherwise every command would have a C:\Windows\System 32 in front of it.
Then for every line in the file put
echo data in the line>>filepath
For the filepath involving the username where the username has to be, put
So in our case the code would be
echo This is the best instructable ever!>>C:\Users\%Username%\Desktop\file.txt
echo Thanks to Super_Nerd>>C:\Users\%Username%\Desktop\file.txt
Say you want to overwrite a file. To do so just make the >> to an >
> = Overwrite
>> = Add to file
Therefore to overwrite, make the first line have a > and the rest have >>.
See where the code says file.txt? That is the filename. Feel free to change it to whatever you want. If you don't add an extention it turns into a file. Confusing right? A file is a file with no extention, hence you have to choose what to open it with every time.
Step 3: Adding the 1s and 0s to the Drive
AKA saving the file
Save it as something like installer.bat
It can be whatever you want as long as it ends in .bat or .cmd
Step 4: Fire It Up!
Now test your new creation by double clicking on the icon with the gears. As always comment any problems or ideas you had.
jakejakey1208 made it!