File Maker V0.1

by Tanmay Das in Circuits > Computers

147 Views, 0 Favorites, 0 Comments

File Maker V0.1

MS DOS Batch File.png
Today I saw an instructable about a .bat file for creating another file. The code was simple, but to change the name, location and the data of the file you have to open it in Notepad and edit it, save it and use it.

So I thought that I can make a better one and came up with my File Maker.

In my File Maker, you can choose the location, name, extension and data to put in the file. Currently you cannot add multiple lines in your file but I'm working on it's second version and soon will post it.

Such a bath file is particularly useless, but I made it because I felt like it. If you also feel like making it then go on.

Code

MS DOS Batch File.png
Open Notepad copy and paste the following code in it.

@echo off
title File Maker v0.1
color 0a

:back
cls
echo.
echo Enter file location
set/p "loc="
echo.
echo Enter filename with extension
set/p "file="
cls
echo.
echo File location
echo %loc%
echo.
echo File name
echo %file%

:top
echo.
echo Create File
echo Y for Yes
echo N for No
echo E for Exit
echo.
set/p "auth="
if %auth%==Y goto data
if %auth%==y goto data
if %auth%==N goto back
if %auth%==n goto back
if %auth%==E goto end
if %auth%==e goto end
echo.
echo Wrong Input
goto top

:data
cls
echo.
echo Enter your data in the file (text only)
set/p "data="
cls

:sec
echo.
echo Write File %loc%\%file%? (Y/N)
set/p "ask="
if %ask%==Y goto make
if %ask%==y goto make
if %ask%==N goto back
if %ask%==n goto back
echo.
echo Wrong Input
goto sec

:make
echo.
echo %data% >> "%loc%\%file%
cls
echo.
echo File Created.....
pause
cls

:doyou
echo.
echo Do you want to create another file? (Y/N)
set/p "aga="
if %aga%==Y goto back
if %aga%==y goto back
if %aga%==N goto end
if %aga%==n goto end
echo.
echo Wrong Input
goto doyou

:end
exit 

Save it as anything.bat

How to Use It

MS DOS Batch File.png
Using it is really simple.

First Enter the location where you want to create your file.
e.g. If you want your file to be created in D drive: Enter D:

Next enter file name with extension.
e.g. myfile.txt, myfile.bat, myfile.doc, myfile.vbs

Next confirm that the entered info is correct by entering Y or re-enter location and file name by entering N or exit by entering E .

Next enter the data to be added in the file.
Currently only continuous lines can be added.

Next confirm create file by entering Y

One important thing to remember is that File Maker adds a ( \ )  between the location and the file name. So do not add a ( \ )  at the end of the location.