![](/img/trans.png)
[英]Running a powershell command inside cmd script and replacing string content
[英]Replacing a String in a command script
我是CMD Commands的新手,我要尋找的是CMD應該詢問開始和結束號,然后在括號之間替換它。 CMD也可以要求選擇源文件,並且還應要求文件夾粘貼代碼示例中的文件。
再次感謝
@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
此處無需echo
。 您要使用數字而不打印它。
只是:
for /L %%f in (%start%,1,%end%) do ...
(還要注意%%f
。在批處理文件中,必須將百分號加倍)
要詢問源文件和目標文件夾,只需再使用兩個set /p
命令。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.