在cmd中或制作批处理文件时,我不能使用命令msg
。当我尝试使用它时,它返回错误msg is not recognized as an internal or external command, operable program or batch file
。“我非常确定错误是我在system32中丢失了一个msg.exe
,所以有人能告诉我如何获得它吗?我正在运行Windows8.1。
发布于 2015-06-22 18:27:23
msg.exe
并非在所有环境中的所有Windows平台上都可用。
在Windows7 x64企业版上只有%SystemRoot%\System32\msg.exe
(64位),但没有%SystemRoot%\SysWOW64\msg.exe
(32位),因此必须使用%SystemRoot%\Sysnative\msg.exe
从32位命令进程中访问64位msg.exe
。
有关System32
、SysWOW64
和Sysnative
的详细信息,请参阅微软文档页面File System Redirector。
这是什么意思?
在32位上执行的批处理文件需要运行%SystemRoot%\System32\msg.exe
.
运行%SystemRoot%\System32\msg.exe
.需要运行
cmd.exe
在64位Window上执行的批处理文件运行%SystemRoot%\Sysnative\msg.exe
.需要运行
cmd.exe
在64位Window上执行的批处理文件它取决于父进程启动cmd.exe
或批处理文件的体系结构,如果批处理文件在64位Windows32位或64位环境中执行,则会隐含地导致启动cmd.exe
以执行批处理文件。
因此,批处理文件是通过显式使用%SystemRoot%\Sysnative\cmd.exe
从Windows x64上的32位应用程序中调用的,或者在批处理文件中,%SystemRoot%\Sysnative\msg.exe
在Windows x64机器上使用,而在Windows x86机器上%SystemRoot%\System32\cmd.exe
则必须分别使用%SystemRoot%\System32\msg.exe
。
使用64位命令行解释器的第一个变体的演示示例:
名为MsgDemo.bat
的批处理文件
@echo off
%SystemRoot%\System32\msg.exe /?
pause
从运行在x64上的32位进程调用:
%SystemRoot%\Sysnative\cmd.exe /C MsgDemo.bat
引用msg.exe
的第二个变体的演示示例:
@echo off
set "AppMsg=%SystemRoot%\System32\msg.exe"
if not "%ProgramFiles(x86)%" == "" (
rem Explicitly reference 64-bit version on Windows x64 as there is
rem no 32-bit version. But use Sysnative redirector only if the batch
rem file was started with 32-bit cmd.exe as otherwise System32 contains
rem msg.exe if it is not missing at all like on Windows 7 Home Premium.
if exist %SystemRoot%\Sysnative\* set "AppMsg=%SystemRoot%\Sysnative\msg.exe"
)
%AppMsg% /?
set "AppMsg="
pause
重定向器%SystemRoot%\Sysnative
不适用于64位进程,仅适用于32位进程。
%SystemRoot%\Sysnative
不是目录。因此if exist %SystemRoot%\Sysnative
不起作用,只有if exist %SystemRoot%\Sysnative\*
起作用。
发布于 2018-12-01 17:33:54
从system32中的任何windows 7 PC复制msg.exe并越过目标PC system32目录。
对我来说很好
https://stackoverflow.com/questions/30972651
复制相似问题