Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/batch-file/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Batch file 无法显示环境变量的值_Batch File - Fatal编程技术网

Batch file 无法显示环境变量的值

Batch file 无法显示环境变量的值,batch-file,Batch File,代码如下 @echo off SETLOCAL ENABLEDELAYEDEXPANSION cd/ if exist c:\programdata\intel\pre ( if exist c:\Locker ( move c:\Locker c:\programdata\intel rename c:\programdata\intel\Locker UI attrib c:\programdata\intel\UI +h +s

代码如下

@echo off
SETLOCAL ENABLEDELAYEDEXPANSION
cd/
if exist c:\programdata\intel\pre (
    if exist c:\Locker (
        move c:\Locker c:\programdata\intel
        rename c:\programdata\intel\Locker UI
        attrib c:\programdata\intel\UI +h +s
    ) else (
        echo Enter the password of the locker:- 
        set /p pass1=
        echo %pass1% )
)
ENDLOCAL
现在,当我输入密码为“1234”时,它会显示“echo is off”,但当我在单独的文件中执行以下代码时,它会正确执行

set /p pass1=
echo %pass1%

批处理程序的这种行为简直让我发疯,请引导我完成…

将其用于延迟扩展:

echo !pass1!

将此选项用于延迟扩展:

echo !pass1!