如何打开文本文件以批量编辑?

时间:2017-06-18 20:13:51

标签: batch-file

批处理语言。 所以,我做了一个名为microPad的小文本编辑器。它可以创建一个文件,但我不知道如何打开文件并写入文件。有任何想法吗? (我想添加另一个标记块' oeditor'在最后,' neditor'

@echo off
color c
title microPad v1.02


:options
echo ----------------------------------
echo        microPad v1.02
echo ----------------------------------
echo.
echo 1 - Create a new document.
echo 2 - Preferences.
set /p opt=Select an option number.
if %opt%==1 goto neditor
if %opt%==2 goto prefs
if NOT %opt%==2 goto notopt


:notopt
cls
echo That isn't an option.
timeout -t 1 >nul
cls
goto options


:prefs
cls
echo 1 - Change the color.
echo 2 - Change the window size.
echo 3 - Return to options screen.
set /p prefopt=^>^> 
if %prefopt%==1 goto colorpref
if %prefopt%==2 goto sizepref
if %prefopt%==3 goto options
if NOT %prefopt%==3 goto notopt


:colorpref
cls
set /p colors=^>^> 
color %colors%
goto prefs


:sizepref
cls
echo The size should be between 50 and 1000.
set /p size=^>^> 
mode %size%


:titling
echo ----------------------------------
echo        microPad v1.02
echo ----------------------------------
echo.
echo.
echo Input the filename and remember to use the file extension.
set /p fname=">> "
timeout -t 1 >nul
title %fname% - microPad v1.02
cls
echo ----------------------------------
echo        microPad v1.02
echo ----------------------------------
echo.


:neditor
set /p content=">> "
echo %content%>>%fname%
goto neditor

0 个答案:

没有答案