Board logo

标题: [文本处理] 批处理怎么重置所有变量? [打印本页]

作者: 502283644    时间: 2014-9-27 21:58     标题: 批处理怎么重置所有变量?

set /p a=
................................................................
作者: 普大喜奔    时间: 2014-9-27 22:31

回复 1# 502283644
我连题都看不懂。。。
作者: 523066680    时间: 2014-9-27 22:41

回复 2# 普大喜奔


    可能是没事做随便打出点什么就发表了……
作者: CrLf    时间: 2014-9-28 00:16

1、除非你知道在做什么,否则不建议用这种办法:
  1. for /f "eol== delims==" %%a in ('set') do set "%%a="
复制代码
2、较推荐:
  1. set a=test
  2. setlocal
  3. ::可以理解成一个“还原点”
  4. set a=100
  5. endlocal
  6. ::还原到上一个 setlocal 之前的变量状态
  7. echo %a%
复制代码

作者: Linuxer    时间: 2014-9-28 00:29

先保存一份bak再说清的事,,
  1. set > path_bak.txt
复制代码

作者: 502283644    时间: 2014-9-30 22:32

回复 3# 523066680


    有一些变量不想要了就想中途删除变量
作者: 502283644    时间: 2014-9-30 22:35

echo set /a asd=1234567

后面的asd变量都是1234567
想中途停止使用
作者: Linuxer    时间: 2014-9-30 23:05

回复 7# 502283644
  1. @echo off
  2. set a=123
  3. echo %a%
  4. set a=
  5. echo,%a%
  6. pause
复制代码





欢迎光临 批处理之家 (http://bbs.bathome.net/) Powered by Discuz! 7.2