Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the reason for the error message "System cannot find the path specified"?

Tags:

I have folder run in folder system32. When I run cmd from within Total Commander opening a command prompt window with C:\Users\admin as current directory and want to go into that folder, the following error message is output:

System cannot find the path specified.

When I open cmd directly in folder run, it works perfect. Why?

The command prompt window on opening in C:\Windows\System32\run:

C:\Windows\System32\run>cd..  C:\Windows\System32>cd run  C:\Windows\System32\run> 

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:\Users\admin>cd..  C:\Users>cd..  C:\>cd windows  C:\Windows>cd system32  C:\Windows\System32>cd run Systém nemôže nájst’ zadanú cestu. 
like image 396
Mi1anovic Avatar asked Nov 10 '15 19:11

Mi1anovic


People also ask

Can write temp file the system Cannot find the path specified?

Solution. Confirm what the Temporary Directory should be. Go to the Atom Management > runtime > Properties > Basic > Temporary Directory. Once confirmed, check the directory exists and can be accessible from the server the runtime is installed on.


2 Answers

The following worked for me:

  1. Open the Registry Editor (press windows key, type regedit and hit Enter) .
  2. Navigate to HKEY_CURRENT_USER\Software\Microsoft\Command Processor\AutoRun and clear the values.
  3. Also check HKEY_LOCAL_MACHINE\Software\Microsoft\Command Processor\AutoRun.
like image 199
aishanib7 Avatar answered Oct 21 '22 08:10

aishanib7


There is not only 1 %SystemRoot%\System32 on Windows x64. There are 2 such directories.

The real %SystemRoot%\System32 directory is for 64-bit applications. This directory contains a 64-bit 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-bit applications can access %SystemRoot%\System32 for 64-bit applications by using the alias %SystemRoot%\Sysnative in path.

For more details see the Microsoft documentation about File System Redirector.

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.

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" 

Every console application in System32\run directory must be executed with %SystemPath% in the batch file, for example %SystemPath%\run\YourApp.exe.

How it works?

There is no environment variable ProgramFiles(x86) on Windows x86 and therefore there is really only one %SystemRoot%\System32 as defined at top.

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

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%\Sysnative\cmd.exe or more general if exist %SystemRoot%\Sysnative\*.

like image 30
Mofi Avatar answered Oct 21 '22 07:10

Mofi