我在Windows7机器上运行Cygwin,并在上面运行Cygwin ssh服务器。在Linux上,我有一个shell脚本,我想在其中执行以下操作
ssh myuser@mymachine "qwinsta | grep Active"查看谁已登录。这在Windows Server2008 R2机器上运行良好,但在Windows7上似乎有问题。
如果我在Windows7计算机上尝试执行此操作,我会得到:
bash: qwinsta: command not found现在,这就是奇怪的开始。
如果我正常登录Windows7计算机,并使用Windows资源管理器查看C:\ Windows \System32,我会看到qwinsta.exe。如果我打开一个CMD会话并在C:\Windows\System32中执行dir,我会看到qwinsta.exe。如果我打开Cygwin shell并在/cygdrive/c/Windows/System32中执行ls qwinsta.exe,我会得到:
ls: cannot access qwinsta.exe: No such file or directory如果我从Cygwin shell执行cmd /c dir C:\\\\Windows\\\\System32\\\\qwinsta.exe,我得到一个“未找到文件”
如果我将qwinsta.exe复制到Cygwin主目录中,则可以使用ls在我的主目录中看到它。如果我尝试从Cygwin shell运行qwinsta的本地副本,它会运行,但也会输出一行:
{Message(): LoadString failed, Error 15105, (0x00003B01)}Windows 7上的qwinsta是怎么回事?
发布于 2011-12-06 00:50:33
问题是qwinsta.exe实际上并不位于C:\Windows\System32中。它实际上位于
C:\Windows\winsxs\amd64_microsoft-windows-t..commandlinetoolsmqq_31bf3856ad364e35_6.XX.XXX.XXXX_none_XXXXXXXX\qwinsta.exe使用上述路径(或指向相同路径的软链接)将运行任何计算机上的qwinsta.exe,而不需要将可执行文件复制到主目录。
错误消息{Message(): LoadString failed, Error 15105, (0x00003B01)}是关于多行用户界面(本地化)系统无法找到正在运行的程序的错误消息本地化信息(请参见System Error Codes)。在这种情况下,cygwin shell似乎没有为qwinsta.exe提供在您的语言的语言环境文件夹(通常是C:\Windows\System32\en-US或您的语言环境)中查找qwinsta.exe.mui所需的信息。查看此文件夹有点误导,因为资源管理器将显示此目录中的文件,但当您运行ls /cygdrive/c/Windows/System32/en-US时,没有qwinsta.exe.mui文件。我怀疑这与NTFS中新的链接结构有关(参见mklink命令),但我还没有想出如何修复这部分问题。
发布于 2016-04-19 08:46:56
已解决:
C:\Windows\winsxs\amd64_microsoft-windows-t..commandlinetoolsmqq_31bf3856ad364e35_6.1.7600.16385_none_851e6308c5b62529 (复制并粘贴该位置与手动查找相同。)您应该会找到三个文件:Msg.exe、Quser.exe和qwinsta.exe。将这些文件复制到您的C:\Windows\system32 folderC:\Windows\winsxs\amd64_microsoft-windows-t..etoolsmqq.resources_31bf3856ad364e35_6.1.7600.16385_en-us_7bef78d9f4a6a8ac您应该会找到三个名称相似的文件,除了这些文件将以.mui结尾。
C:\Windows\system32\en-US文件夹。msg程序。它应该可以正常工作,不会出现问题。发布于 2020-04-13 00:47:19
Windows 10
在Erutan2099's answer之后,对于Windows10,这有点棘手,因为文件是压缩的(二进制增量压缩,文件签名44 43 53 01)。尝试按原样使用它们会抛出不支持的16位应用程序错误:
由于与64位版本的
不兼容,程序或功能"\??\C:\Windows\System32\msg.exe“无法启动或运行。请与软件供应商联系,询问是否有64位Windows兼容版本。
已经制作了一个特定的工具来解压缩这些文件: (this post为我指明了正确的方向)
用法:
> sxsexp64.exe msg.exe expand\msg.exe
Processing target path msg.exe
msg.exe => expand\msg.exe
File size 12602 bytes
DCS_HEADER found.
NumberOfBlocks 1
UncompressedFileSize 26112
DCS_BLOCK #1
Block->CompressedBlockSize 0000312A
Block->DecompressedBlockSize 00006600
Operation Successful> sxsexp64.exe msg.exe.mui expand\msg.exe.mui
Processing target path msg.exe.mui
msg.exe.mui => expand\msg.exe.mui
File size 2150 bytes
DCS_HEADER found.
NumberOfBlocks 1
UncompressedFileSize 7680
DCS_BLOCK #1
Block->CompressedBlockSize 00000856
Block->DecompressedBlockSize 00001E00
Operation Successful这些解压缩的文件现在可以分别复制到C:\Windows\System32和C:\Windows\System32\en-US。
示例:
> msg * Hello, World!

https://stackoverflow.com/questions/7041277
复制相似问题