如何在批处理文件中添加变量 [英] How to add variables in a batch file

查看:147
本文介绍了如何在批处理文件中添加变量的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试获取数字列表,例如11111111之类的字母和一个字母.字母si用数字计算.像这样:

I'm trying to get a list of numbers an letters like 11111111 and a letter. Letter si calculated with the number. Something like:

@echo off
set var=23
FOR /L %%H IN (40000000,1,49999999) DO (
set number = %%H+%var%
echo %number%A
)
pause
exit

我想(或多或少)

400000023A
400000024A
400000025A
...

但是在不更改FOR语句的情况下...有可能吗?

But without changing the FOR sentence... Is that possible?

推荐答案

要继续执行jeb所说的内容,对于您要求的输出,代码应为:

To continue with what jeb stated, for your requested output, the code should be this:

@echo off & setlocal EnableDelayedExpansion
set var=23
FOR /L %%H IN (40000000,1,49999999) DO (
  set /a number=%%H+!var!
  echo !number!A
)
endlocal
pause
exit

这篇关于如何在批处理文件中添加变量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆