VS Code 系统找不到指定的路径

VS Code The system cannot find the path specified

我正在尝试 运行 我的学校作业是关于 VS 代码的,但我收到了这个错误。 我已经在家里 运行 编译我的代码,它总是工作得很好,但这个文件只是不想 运行。

这是我从终端得到的

Copyright (C) Microsoft Corporation. All rights reserved.

Try the new cross-platform PowerShell https://aka.ms/pscore6

PS C:\Users\orave\Google Drive\APCSA\PROG 2\Introduction & Analysis of Algorithms\Sorting Stats\selection&insertionSort>  & 'c:\Users\orave\.vscode\extensions\vscjava.vscode-java-debug-0.31.0\scripts\launcher.bat' 'C:\Program Files\AdoptOpenJDK\jdk-11.0.9.101-hotspot\bin\java.exe' '-Dfile.encoding=UTF-8' '-cp' 'C:\Users\orave\AppData\Roaming\Code\User\workspaceStoragee4f84fdbcb8ec16980a673d4ef46a02\redhat.java\jdt_ws\selection&insertionSort_48006976\bin' 'sortingAlgorithms'
Usage: java [options] <mainclass> [args...]
           (to execute a class)
   or  java [options] -jar <jarfile> [args...]
           (to execute a jar file)
   or  java [options] -m <module>[/<mainclass>] [args...]      
       java [options] --module <module>[/<mainclass>] [args...]
           (to execute the main class in a module)
   or  java [options] <sourcefile> [args]
           (to execute a single source-file program)

 Arguments following the main class, source file, -jar <jarfile>,
 -m or --module <module>/<mainclass> are passed as the arguments to
 main class.

 where options include: // just some arguments

The system cannot find the path specified.

在我赢得足够的声誉之前,我显然不能在其他帖子上发表评论。我打算请您分享您尝试 运行 的代码以及您认为可能有助于更好地理解导致此问题的任何其他信息。自代码上次 运行ning 以来发生了什么变化?

我看到你的 PATH 中有一个 space,这里是:

C:\Users\orave\Google Drive\APCSA\PROG

我过去在 VS Code 上遇到过这个问题,其中这样的 PATH 不起作用:

C:\Program Files\Microchip\xc8\v2.32\bin\xc8.exe

错误信息:

C:\Users\raymu_000\Documents\Programming\VisualStudioCode\PIC_C_on_VSCode\L298N-
MotorDriver_Test>C:\Program Files\Microchip\xc8\v2.32\bin\xc8.exe
--chip=16f887 --outdir="./output-files" --output=lpp "./Project/init-PWM.c"

'C:\Program' is not recognized as an internal or external command, operable program or batch file.

这可以通过在特定路径周围添加引号 "" 来解决

"C:\Program Files\Microchip\xc8\v2.32\bin\xc8.exe"

或者这样写:

C:\Progra~1\Microchip\xc8\v2.32\bin\xc8.exe

但我坚持认为,您应该为您的问题添加更多上下文。希望这在某种程度上有所帮助。

我将 VS 代码打开到我的学校文件夹,而不是我的项目文件夹,编译器希望 运行 与主文件位于同一文件夹中。

@Ray-Nevarez: 没错,文件夹路径中的 space 就是问题所在。我有一个类似的问题 - 在某些情况下更改默认文件夹可能无济于事,因为某些情况下您无权更改默认文件夹或出于某些原因不想更改路径。 最好在 VSCode 上包含文件的完整路径 - 它对我有用。 我的文件夹路径在 Google Drive G:\My Drive\VSCODES...我在三个不同的位置使用三台不同的 PC。我更喜欢同步我的文件并方便地从任何位置工作,而无需远程连接到另一台 PC。 注意:确保将文件夹名称包含在引号中 space。 例如:G:\My Drive\VSCODE, (My Drive 应该是“My Drive”).