Windows 7 指令未執行

Windows 7 指令未執行

特別嘗試attrib,但我相信 System32 中的所有命令都不起作用。我遇到了路徑變數的問題,我相信現在已經解決了,因為C:\Windows\System32它顯示在變數的末尾%path%。但attrib仍然不起作用:

Microsoft Windows [Version 6.1.7601] Copyright (c) 2009 Microsoft
Corporation.  All rights reserved.

C:\Users\tri-eng>echo %path%
C:\oracle\x86;C:\oracle\iqms\bin;C:\ProgramData\Oracle\Java\javapath;C:\Program
Files (x86)\NVIDIA Corporation\PhysX\Common;c:\Program Files (x86)\AMD
APP\bin\x 86_64;c:\Program Files (x86)\AMD
APP\bin\x86;%SystemRoot%\system32;%SystemRoot%;
%SystemRoot%\System32\Wbem;%SYSTEMROOT%\System32\WindowsPowerShell\v1.0\;C:\Prog
ram Files (x86)\Intel\Services\IPT\;c:\Program Files (x86)\ATI
Technologies\ATI. ACE\Core-Static;C:\Program Files\Dell\Dell Data
Protection\Access\Advanced\Wave\ Gemalto\Access Client\v5\;C:\Program
Files (x86)\NTRU Cryptosystems\NTRU TCG Sof tware
Stack\bin\;C:\Program Files\NTRU Cryptosystems\NTRU TCG Software
Stack\bin " ;C:\Users\tri-eng\Documents\nodejs\;C:\Windows\System32;

C:\Users\tri-eng>attrib
// DOESN'T WORK! 
'attrib' is not recognized as an internal or
external command, operable program or batch file.

C:\Users\tri-eng>C:\Windows\System32\attrib A           
// WORKS!
// ...(output of attrib command)...


C:\Users\tri-eng>

也許與註冊表有關?

答案1

問題是%PATH%環境變數沒有自動擴展,即%systemroot%值沒有擴展為C:\Windows\System32.

%PATH%這是由於在軟體安裝過程中錯誤地重寫了我的環境變數所造成的。

為了解決這個問題,我替換了%PATH%註冊表項,如下所示:

在 Windows 7 中:

  1. 搜尋regedit.exe並運行它。圖形使用者介面打開。

  2. 向下導航至HKEY_LOCAL_MACHINE > SYSTEM > ControlSet > Control > Session Manager > Environment

  3. 檢查 PATH 變數的類型。如果是 REG_SZ,則此修復可能有效。

  4. 將 PATH 變數的內容複製到記事本以便妥善保管

  5. 刪除路徑變數

  6. 右鍵點選>新建>可擴充字串變數

  7. 將名稱設定為 PATH

  8. 將內容設定為步驟 4 複製的值

  9. 需要重新啟動才能生效

相關內容