Batch File Reference Help

April 2, 2009 at 10:26:47
Specs: Windows Vista
I was given a challenge by a friend to make a Batch File Notepad.

However, the one i've made isn't working.

I've set it up so that it will save each line as a separate text file, the i hope to join them at the end.

Can someone look at it and diagnose the problem?

=======================================

:startup
@echo off

:main
cls
@echo off
Echo Hello, welcome to my Batch Notepad
ECHO.
Echo Press 's' for New Document
set choice=
set /p choice=Press the Appropraite Character:
if not '%choice%'=='' set choice=%choice:~0,1%
if '%choice%'=='S' goto place
if '%choice%'=='s' goto place
Echo.

:place
@echo off
cls
set /p place=Where would you like to save your document?:

:name
@echo off
cls
set /p name=What would you like to save it as?:

:header
@echo off
cls
Echo This is the typing area.
Echo Press Enter for a New Line.
Echo Input 'ext' to save.

:1
@echo off
set /p 1=""
if not '%1%'=='' set 1=%1:~0,1%
if '%1%'=='ext' goto save
if '%1%'=='Ext' goto save
if '%1%'=='eXt' goto save
if '%1%'=='exT' goto save
if '%1%'=='EXt' goto save
if '%1%'=='eXT' goto save
if '%1%'=='EXT' goto save
Echo.

:1save
@echo off
%1% > "%place%\line1.txt"

:2
@echo off
set /p 2=
if not '%2%'=='' set 2=%2:~0,1%
if '%2%'=='ext' goto save
if '%2%'=='Ext' goto save
if '%2%'=='eXt' goto save
if '%2%'=='exT' goto save
if '%2%'=='EXt' goto save
if '%2%'=='eXT' goto save
if '%2%'=='EXT' goto save
Echo.

:2save
@echo off
%2% > "%place%\line2.txt"

:3
@echo off
set /p 3=
if not '%3%'=='' set 3=%3:~0,1%
if '%3%'=='ext' goto save
if '%3%'=='Ext' goto save
if '%3%'=='eXt' goto save
if '%3%'=='exT' goto save
if '%3%'=='EXt' goto save
if '%3%'=='eXT' goto save
if '%3%'=='EXT' goto save
Echo.

:3save
@echo off
%3% > "%place%\line3.txt"

:4
@echo off
set /p 4=
if not '%4%'=='' set 4=%4:~0,1%
if '%4%'=='ext' goto save
if '%4%'=='Ext' goto save
if '%4%'=='eXt' goto save
if '%4%'=='exT' goto save
if '%4%'=='EXt' goto save
if '%4%'=='eXT' goto save
if '%4%'=='EXT' goto save
Echo.

:4save
@echo off
%4% > "%place%\line4.txt"

:5
@echo off
set /p 5=
if not '%5%'=='' set 5=%5:~0,1%
if '%5%'=='ext' goto save
if '%5%'=='Ext' goto save
if '%5%'=='eXt' goto save
if '%5%'=='exT' goto save
if '%5%'=='EXt' goto save
if '%5%'=='eXT' goto save
if '%5%'=='EXT' goto save
Echo.

:5save
@echo off
%5% > "%place%\line5.txt"

=======================================


See More: Batch File Reference Help

Report •


#1
April 2, 2009 at 18:06:49
This seems like an awfully convoluted way to do this (untested):
@ECHO OFF
SET name="%~1"
IF NOT %name%=="" GOTO skip
SET /P name=File name/path? 
:skip
ECHO Type whatever, end w/ F6
COPY CON %name%


Report •
Related Solutions


Ask Question