在预设位置打印序号

时间:2014-11-04 14:11:39

标签: batch-file

我正在尝试编写一个简单的程序,它将在两个设定数字之间按顺序打印页码,位于指定位置,例如右下角或顶部中心。我已经尝试了所有我能想到的方法,但是如果我将第一页设置为以比上一个更高的值打印,程序将只写入文件。即使这样,也只提交了一个号码。这是目前为止的编码。一些帮助将不胜感激。自从我上次编写程序已有30多年了,我有点生疏了。

ECHO OFF
REM  To print sequential numbers at a specified point on pages i.e. bottom right or top center. starting
REM from a given number (a) and ending with the second given number (b)
CLS
ECHO Enter the number of the first page to print
SET  /P a=[promptString                          ]
ECHO Enter  the number of the last page to print
SET /P b=[promptString                           ]
REM  requires coding to identify the position to print ie bottom right or top center
CLS
ECHO
ECHO
ECHO
ECHO                        Printing from page number   
ECHO                                  %a%
ECHO                             to page number 
ECHO                                  %b%
PAUSE
:L
ECHO %a%> test.txt
REM send value of a to file text.txt to print 
REM requires coding to print each page from text.txt ejecting each page after printing
SET /a a=(%a+1)
REM Increments value of a to next page value then returns to file and print new value of a 
IF %a% GTR %b% GOTO X
REM Stops printing at last page (value b)
GOTO L
:X
EXIT

1 个答案:

答案 0 :(得分:0)

只需重复评论中的正确答案,即可显示为已回答!

SET /a a=(%a+1)

应该是

SET /a a += 1