Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
I am trying to make a batch file that when clicked will create a blank batch file and let you type in the name then it will automatically save it as a .bat file
I am only skilled enough to do the following whick just lets you drag a txt document onto to it then name it and it pops out as a batch file
@echo off
cls
set /p var=File name:%var%
clsRENAME %1 "%var%.bat"
Fuzzymango209

The batch below should do it, it will automatically append a .bat file extension if you don't add .bat or .cmd to the end of your filename.
@ECHO OFF
:INPUT
CLS
SET /P FLNM=PLEASE INPUT A FILE NAME FOR YOUR NEW BATCH FILE. /Q EXITS.
IF NOT DEFINED FLNM GOTO INPUT
IF /I "%FLNM%"=="/Q" GOTO :EOF
IF /I NOT "%FLNM:~-4%"==".BAT" IF /I NOT "%FLNM:~-4%"==".CMD" SET FLNM=%FLNM%.BAT
IF NOT EXIST "%FLNM%" (COPY NUL "%FLNM%") ELSE ECHO "%FLNM%" ALREADY EXISTS IN THIS DIRECTORY.&&PAUSE&&GOTO INPUT
START NOTEPAD "%FLNM%"
Here's the one I personally use(except for notepad), I don't like to prompted for a file name:
@ECHO OFF
IF NOT EXIST NEW.BAT GOTO MKR
SET COUNT=2
:NWE
IF EXIST NEW%COUNT%.BAT SET /A COUNT+=1&&GOTO NWE
:MKR
ECHO @ECHO OFF>NEW%COUNT%.BAT
START NOTEPAD NEW%COUNT%.BATIt may not be the most elegant solution but it does the job just fine....

I got tired of renaming or saving txt files at batch scripts so i whipped this up.
@echo off
echo Enter name of batch file
set /p name=
echo Enter location to save file
set /p location=
echo @echo off > %location%\%name%.batThis will ask for the name then a location. So typing in Hey for the name and h:\ for location will create H:\Hey.bat

![]() |
VBScript to connect to SQ...
|
Renaming alot of files
|

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.
| Ads by Google |