我的部署部署是在Windows上的Makefile上运行一个名为“deploy”的目标,该目标运行taskkill.exe和psexec.exe等。两者都在c:\ windows \ system32中,位于%PATH%
。
当我尝试制作该目标时,我收到一条消息,指出无法找到psexec。 Taskkill按预期工作。
作为测试,我试图简单地dir c:\windows\system32\psexec.exe
,但是从makefile中,我得到了“找不到文件”。但是,在同一个shell中,我可以运行相同的dir命令并获得肯定的响应。
为什么甚至不能看到该文件存在,更不用说运行它了?
这是一个Makefile目标示例:
exetest:
@echo ------------------------------
-dir /b c:\Windows\System32\PsExec.exe
@echo ------------------------------
-dir /b c:\Windows\System32\taskkill.exe
这就是命令提示符中发生的事情:
C:\Users\Owner\Documents\GitHub>make exetest
------------------------------
dir /b c:\Windows\System32\PsExec.exe
File Not Found
make: [exetest] Error 1 (ignored)
------------------------------
dir /b c:\Windows\System32\taskkill.exe
taskkill.exe
C:\Users\Owner\Documents\GitHub>dir /b c:\Windows\System32\PsExec.exe
PsExec.exe
C:\Users\Owner\Documents\GitHub>dir /b c:\Windows\System32\taskkill.exe
taskkill.exe
我正在运行GNU Make 3.81和Windows 7。
我已经尝试了psexec和psexec64 - 两者都有相同的行为。
答案 0 :(得分:1)
此处的问题是make
,而不是psexec
或psexec64
所有32位进程都放在file system redirector下。
每当32位应用程序尝试访问
%windir%\System32
时,访问权限都会重定向到%windir%\SysWOW64
您似乎正在使用32位make
程序。因此,它不会在%windir%\System32
中看到PsExec.exe。如果您使用%windir%\SysWOW64\cmd.exe
运行32位shell,行为是相同的,在这种情况下,dir /b c:\Windows\System32\PsExec.exe
将为您找到一个未找到文件的错误
您必须修改%windir%\Sysnative\PsExec.exe
。