Computing.Net > Forums > Programming > Batch File Reference Help

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Click here to start participating now! Also, check out the New User Guide.

Batch File Reference Help

Reply to Message Icon

Name: jcgun
Date: April 2, 2009 at 10:26:47 Pacific
OS: Windows Vista
Subcategory: Batch
Comment:

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"

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



Sponsored Link
Ads by Google

Response Number 1
Name: Razor2.3
Date: April 2, 2009 at 18:06:49 Pacific
Reply:

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%


0
Reply to Message Icon

Related Posts

See More


Compare the installed RPM... Create a bat file



Post Locked

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


Go to Programming Forum Home


Sponsored links

Ads by Google


Results for: Batch File Reference Help

Simple Batch File command help www.computing.net/answers/programming/simple-batch-file-command-help/16568.html

Batch File Formmatting Help, Please www.computing.net/answers/programming/batch-file-formmatting-help-please/14040.html

Batch File Challenge! Help! www.computing.net/answers/programming/batch-file-challenge-help/10349.html