Replacing a String in a command script

时间:2016-06-18 20:20:39

标签: cmd command copy-paste

I am new to CMD Commands, what I am looking for is the CMD should ask for the start and end number and then replace it between the parantheses. Also can the CMD also ask to select the source file, and also it should ask the folder to paste the files which is in code sample.

Thanks Again

@ECHO off 
SET /P start=Please enter Starting Number: 
SET /P end=Please enter Ending  Number:
for /L %f in  (echo %start%,1,echo %end%) do copy I:\EXP\new.txt I:\EXP\new-%f.txt

1 个答案:

答案 0 :(得分:1)

这里不需要echo。您希望使用不是打印的数字。

只是:

 for /L %%f in (%start%,1,%end%) do ...

(另请注意%%f。在批量文件中,您必须将百分号翻倍)

要询问源文件和目标文件夹,只需再使用两个set /p命令。