IF EXIST在Windows批处理中的C:\ Windows \ System32中的文件上的错误行为(Inno Setup) [英] Wrong behavior of IF EXIST on a file in C:\Windows\System32 in Windows batch (Inno Setup)

查看:314
本文介绍了IF EXIST在Windows批处理中的C:\ Windows \ System32中的文件上的错误行为(Inno Setup)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试通过Inno Setup使用批处理脚本复制一个Windows .dll文件.

I'm trying to copy one Windows .dll file by using a batch script through Inno Setup.

显然,即使C:\Windows\System32中没有msvcr120.dll文件(我可以确认),我也只能看到文件存在" . 当然,我也尝试删除下面的双引号.

Apparently, even though there is no msvcr120.dll file in C:\Windows\System32 (I can confirm) I can only see "file exists". Of course, I also tried to remove double quotation below.

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

你能告诉我哪里出问题了吗?

Can you tell me what is wrong?

[Run]

Filename: "{app}\bin\Icacls\cacls.bat"; Parameters: """{app}"""
Filename: "{app}\Install\psql_init.bat"; Parameters: """{app}"""

其他结果

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).

更新

Windows 7 64位,在C:\ Windows \ SysWOW64中有一个msvcr120.dll. 但是我正在尝试将文件从源目录复制到C:\ Windows \ System32.

UPDATE

Windows 7 64bit and there is a msvcr120.dll in C:\Windows\SysWOW64 instead. But I'm trying to copy the file from my source dir to C:\Windows\System32.

推荐答案

该文件可能存在于C:\Windows\SysWOW64中.

Inno Setup是32位应用程序.因此,默认情况下,要运行批处理文件,它将执行32位的cmd.exe.

Inno Setup is a 32-bit application. So by default, to run a batch file, it executes the 32-bit cmd.exe.

查询C:\Windows\System32时的32位cmd.exe被重定向C:\Windows\SysWOW64.

了解有关有关32位和64位安装的问题

如果使用[Run]部分中的条目运行批处理文件,请使用 64bit标志强制执行64位cmd.exe:

If you are running the batch file using an entry in the [Run] section, use the 64bit flag to force execution of the 64-bit 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中使用它.


Though if it is a 32-bit DLL, you actually want it in the C:\Windows\SysWOW64.

这篇关于IF EXIST在Windows批处理中的C:\ Windows \ System32中的文件上的错误行为(Inno Setup)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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