Board logo

标题: [文本处理] [已解决]call调用后变量为何无法正常显示值? [打印本页]

作者: freesoft00    时间: 2016-1-30 23:55     标题: [已解决]call调用后变量为何无法正常显示值?

本帖最后由 freesoft00 于 2016-2-2 21:56 编辑
  1. @echo off
  2. pushd %~dp0
  3. if exist we.bat (
  4. call :ww
  5. echo %str%
  6. )
  7. pause
  8. exit
  9. :ww
  10. set str=wwww
  11. goto :eof
复制代码
echo %str%不正确,是不是需要开启变量延迟才可以?
作者: /zhqsystem/zhq    时间: 2016-1-31 04:10

回复 1# freesoft00
第6行替换call echo,%%_str%%
第12行替换set _str=wwww
作者: bailong360    时间: 2016-1-31 09:15

是的,开启变量延迟后echo !str!




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