如何设置环境变量以与 TCC 配合使用?

如何设置环境变量以与 TCC 配合使用?

我正在尝试在 Windows 7 上设置 TCC,但似乎无法让它从 cmd 动态运行

To be able to invoke the compiler from everywhere on your computer by
just typing "tcc", please add the directory containing tcc.exe to your
system PATH.

因此我将环境变量“Path”从:

C:\ProgramData\Oracle\Java\javapath;%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;%SYSTEMROOT%\System32\WindowsPowerShell\v1.0\

到:

C:\ProgramData\Oracle\Java\javapath;%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;%SYSTEMROOT%\System32\WindowsPowerShell\v1.0\;C:\compilers\tcc\tcc.exe

但是当我打开cmd时,它仍然说“tcc”不是可识别的命令。

答案1

您已将位置添加到路径中指定的 .exe 文件。您应该做的是添加包含该文件tcc.exe的位置。因此,在您的例子中,环境路径变量应该是这样的foldertcc.exe

C:\ProgramData\Oracle\Java\javapath;%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;%SYSTEMROOT%\System32\WindowsPowerShell\v1.0\;C:\compilers\tcc

假设你的tcc.exe文件在文件夹中C:\compilters\tcc

答案2

Path命令(参见 Windows 命令行参考)

在环境变量中设置命令路径PATH,即 的集合目录用于搜索可执行文件。如果不使用参数,path 将显示当前命令路径。

C:\compilers\tcc\tcc.exe文件夹(目录)名称;据称,应该是C:\compilers\tcc\C:\compilers\tcc(带或不带尾随\反斜杠)。

相关内容