错误信息“系统找不到指定的路径"是什么原因? [英] What is the reason for the error message "System cannot find the path specified"?
问题描述
我在文件夹 system32
中有文件夹 run
.当我从 Total Commander 中运行 cmd
时打开一个命令提示符窗口,其中 C:Usersadmin
作为当前目录并想要进入该文件夹,以下错误消息是输出:
I have folder run
in folder system32
. When I run cmd
from within Total Commander opening a command prompt window with C:Usersadmin
as current directory and want to go into that folder, the following error message is output:
系统找不到指定的路径.
System cannot find the path specified.
当我直接在文件夹run
中打开cmd
时,它工作得很好.为什么?
When I open cmd
directly in folder run
, it works perfect. Why?
在C:WindowsSystem32
un
中打开的命令提示符窗口:
The command prompt window on opening in C:WindowsSystem32
un
:
C:WindowsSystem32
un>cd..
C:WindowsSystem32>cd run
C:WindowsSystem32
un>
简单地运行cmd
的命令提示符窗口:
The command prompt window on simply running cmd
:
Microsoft Windows [Version 6.1.7601]
Copyright (c) 2009 Microsoft Corporation. Všetky práva vyhradené.
C:Usersadmin>cd..
C:Users>cd..
C:>cd windows
C:Windows>cd system32
C:WindowsSystem32>cd run
Systém nemôže nájst’ zadanú cestu.
推荐答案
Windows x64 上有 不仅 1 个 %SystemRoot%System32
.有 2 个这样的目录.
There is not only 1 %SystemRoot%System32
on Windows x64. There are 2 such directories.
真正的 %SystemRoot%System32
目录用于 64 位应用程序.此目录包含 64 位 cmd.exe
.
The real %SystemRoot%System32
directory is for 64-bit applications. This directory contains a 64-bit cmd.exe
.
但是还有用于 32 位应用程序的 %SystemRoot%SysWOW64
.如果 32 位应用程序访问 %SystemRoot%System32
,则使用此目录.它包含一个 32 位的 cmd.exe
.
But there is also %SystemRoot%SysWOW64
for 32-bit applications. This directory is used if a 32-bit application accesses %SystemRoot%System32
. It contains a 32-bit cmd.exe
.
32 位应用程序可以通过在路径中使用别名 %SystemRoot%Sysnative
来访问 64 位应用程序的 %SystemRoot%System32
.
32-bit applications can access %SystemRoot%System32
for 64-bit applications by using the alias %SystemRoot%Sysnative
in path.
有关详细信息,请参阅有关 文件系统的 Microsoft 文档重定向器.
For more details see the Microsoft documentation about File System Redirector.
因此子目录 run
是在 %SystemRoot%System32
中为 64 位应用程序创建的,而 32 位 cmd
是为这个目录不存在是因为在 %SystemRoot%SysWOW64
中没有子目录 run
32 位是 %SystemRoot%System32
cmd.exe
或 子目录 run
是在 %SystemRoot%System32
中创建的,用于 32 位应用程序和 64-bit cmd
在此目录不存在的情况下运行,因为 %SystemRoot%System32
中没有子目录 run
因为该子目录仅存在在 %SystemRoot%SysWOW64
中.
So the subdirectory run
was created either in %SystemRoot%System32
for 64-bit applications and 32-bit cmd
is run for which this directory does not exist because there is no subdirectory run
in %SystemRoot%SysWOW64
which is %SystemRoot%System32
for 32-bit cmd.exe
or the subdirectory run
was created in %SystemRoot%System32
for 32-bit applications and 64-bit cmd
is run for which this directory does not exist because there is no subdirectory run
in %SystemRoot%System32
as this subdirectory exists only in %SystemRoot%SysWOW64
.
如果子目录 run
位于 64 位应用程序的 %SystemRoot%System32
中,则可以在批处理文件的顶部使用以下代码:
The following code could be used at top of the batch file in case of subdirectory run
is in %SystemRoot%System32
for 64-bit applications:
@echo off
set "SystemPath=%SystemRoot%System32"
if not "%ProgramFiles(x86)%" == "" if exist %SystemRoot%Sysnative* set "SystemPath=%SystemRoot%Sysnative"
System32
un
目录中的每个控制台应用程序都必须使用批处理文件中的 %SystemPath%
执行,例如 %SystemPath%
unYourApp.exe
.
Every console application in System32
un
directory must be executed with %SystemPath%
in the batch file, for example %SystemPath%
unYourApp.exe
.
它是如何工作的?
Windows x86 上没有环境变量 ProgramFiles(x86),因此实际上只有一个 %SystemRoot%System32
定义在顶部.
There is no environment variable ProgramFiles(x86) on Windows x86 and therefore there is really only one %SystemRoot%System32
as defined at top.
但是在 Windows x64 上定义了环境变量 ProgramFiles(x86) 的值.因此,如果 %SystemRoot%Sysnative
中有文件,则在 Windows x64 上额外检查.在这种情况下,批处理文件当前由 32 位 cmd.exe
处理,只有在这种情况下才需要使用 %SystemRoot%Sysnative
.否则 %SystemRoot%System32
也可以在 Windows x64 上使用,因为当批处理文件由 64 位 cmd.exe
处理时,这是包含 64-位控制台应用程序(以及子目录 run
).
But there is defined the environment variable ProgramFiles(x86) with a value on Windows x64. So it is additionally checked on Windows x64 if there are files in %SystemRoot%Sysnative
. In this case the batch file is processed currently by 32-bit cmd.exe
and only in this case %SystemRoot%Sysnative
needs to be used at all. Otherwise %SystemRoot%System32
can be used also on Windows x64 as when the batch file is processed by 64-bit cmd.exe
, this is the directory containing the 64-bit console applications (and the subdirectory run
).
注意:%SystemRoot%Sysnative
不是目录!cd
到 %SystemRoot%Sysnative
或使用 if existing %SystemRoot%Sysnative
或 ifexist %SystemRoot 是不可能的%Sysnative
.它是一个仅存在于 32 位可执行文件的特殊别名,因此有必要使用 if existing %SystemRoot%Sysnativecmd.exe
来检查使用此路径时是否存在一个或多个文件更通用的如果存在 %SystemRoot%Sysnative*
.
Note: %SystemRoot%Sysnative
is not a directory! It is not possible to cd
to %SystemRoot%Sysnative
or use if exist %SystemRoot%Sysnative
or if exist %SystemRoot%Sysnative
. It is a special alias existing only for 32-bit executables and therefore it is necessary to check if one or more files exist on using this path by using if exist %SystemRoot%Sysnativecmd.exe
or more general if exist %SystemRoot%Sysnative*
.
这篇关于错误信息“系统找不到指定的路径"是什么原因?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!