Batch file Windows批处理(Inno安装)中C:\Windows\System32中的文件中存在IF的错误行为
我正试图通过Inno安装程序使用批处理脚本复制一个Windows.dll文件 显然,即使Batch file Windows批处理(Inno安装)中C:\Windows\System32中的文件中存在IF的错误行为,batch-file,inno-setup,Batch File,Inno Setup,我正试图通过Inno安装程序使用批处理脚本复制一个Windows.dll文件 显然,即使C:\Windows\System32中没有msvcr120.dll文件(我可以确认),我也只能看到“文件存在”。 当然,我也试图删除下面的双引号 if exist "C:\Windows\System32\msvcr120.dll" ( rem file exists echo "file exists" pause ) else ( rem file doesn't ex
C:\Windows\System32
中没有msvcr120.dll
文件(我可以确认),我也只能看到“文件存在”。
当然,我也试图删除下面的双引号
if exist "C:\Windows\System32\msvcr120.dll" (
rem file exists
echo "file exists"
pause
) else (
rem file doesn't exist
copy %1\Utilities\msvcr120.dll C:\Windows\System32\msvcr120.dll
echo "file doesn't exist"
pause
)
我是手工检查的
C:\Users\changwon>dir /A:HS C:\Windows\System32\msvcr120.dll
Volume in drive C has no label.
Volume Serial Number is 4A80-BDED
Directory of C:\Windows\System32
File Not Found
你能告诉我怎么了吗
如何在Inno安装程序中运行批处理
其他结果
更新
Windows 7 64位,而C:\Windows\SysWOW64中有一个msvcr120.dll。
但我正在尝试将文件从源目录复制到C:\Windows\System32。该文件可能存在于
C:\Windows\SysWOW64
中
Inno安装程序是一个32位应用程序。因此,默认情况下,要运行批处理文件,它会执行32位的cmd.exe
查询C:\Windows\System32
时,将32位cmd.exe
转换为C:\Windows\SysWOW64
了解
如果使用
[Run]
部分中的条目运行批处理文件,请使用强制执行64位cmd.exe
:
[Run]
Filename: "{app}\bin\Icacls\cacls.bat"; Parameters: """{app}"""; Flags: 64bit
Filename: "{app}\Install\psql_init.bat"; Parameters: """{app}"""; Flags: 64bit
虽然如果它是一个32位DLL,但实际上您希望它位于
C:\Windows\SysWOW64
中,也许msvcr120.DLL
是隐藏的?尝试dir/A:HS C:\Windows\System32\msvcr120.dll
;或者有一个同名的目录--将/a:HS
替换为/a:D
,以测试…更新的问题。我没有看到文件。实际上,该文件是存在的,但为了进行测试,我将原始的msvcr120.dll重命名为msvcr120_backup.dll。我的目的是复制不存在的文件。也可以尝试使用dir/A:L C:\Windows\System32\msvcr120.dll
或dir/S C:\Windows\msvcr120.
;或者键入where msvcr120.dll
…好的,那么问题就如我在回答中所描述的那样。你试过64位
标志吗?等一下,genius。我正在测试你的建议…完美!!!!是的,你说得对。它被重定向了。我需要复制64位版本的文件。现在,我的批处理文件检测到它不存在并成功复制!!非常感谢你!!
C:\Users\changwon>dir /A:L C:\Windows\System32\msvcr120.dll
Directory of C:\Windows\System32
File Not Found
C:\Users\changwon>where msvcr120.dll
INFO: Could not find files for the given pattern(s).
[Run]
Filename: "{app}\bin\Icacls\cacls.bat"; Parameters: """{app}"""; Flags: 64bit
Filename: "{app}\Install\psql_init.bat"; Parameters: """{app}"""; Flags: 64bit