The token '&&' is not a valid statement separator in this version.

See original GitHub issue
  • VS Code Version: 1.35.0
  • OS Version: Windows 10 1903
  • Code Runner Version: 0.9.10

Describe the bug

图片

PS C:\test> cd "c:\test\" && gcc test.c -o test && "c:\test\"test
At line:1 char:15
+ cd "c:\test\" && gcc test.c -o test && "c:\test\"test
+               ~~
The token '&&' is not a valid statement separator in this version.
At line:1 char:37
+ cd "c:\test\" && gcc test.c -o test && "c:\test\"test
+                                     ~~
The token '&&' is not a valid statement separator in this version.
At line:1 char:40
+ cd "c:\test\" && gcc test.c -o test && "c:\test\"test
+                                        ~~~~~~~~~~
Expressions are only allowed as the first element of a pipeline.
At line:1 char:50
+ cd "c:\test\" && gcc test.c -o test && "c:\test\"test
+                                                  ~~~~
Unexpected token 'test' in expression or statement.
    + CategoryInfo          : ParserError: (:) [], ParentContainsErrorRecordException
    + FullyQualifiedErrorId : InvalidEndOfLine
 
PS C:\test>

To Reproduce Steps to reproduce the behavior:

Upgrade VSC from 1.34.0 to 1.35.0.


截图没更改execute map;当然改了也是一样的问题。c、c++、c#都有这个问题,所以与语言无关。

宿主机一直可以复现,1.34.0不存在此问题,更新到1.35.0后出现。

我也在我的win7 x86 vm测试了一下,这个问题本来是有的,覆盖1.34.0再覆盖1.35.0后又消失了。

消失是指会用PS的语法,比如&&会被自动替换为分号,会有$?之类的。

Issue Analytics

  • State:open
  • Created 4 years ago
  • Comments:31 (3 by maintainers)

github_iconTop GitHub Comments

82reactions
NguyenManhCam404commented, Feb 6, 2020

You just need to change “&&” to “;”

11reactions
imba-tjdcommented, Jun 6, 2019

Workaround: add "terminal.integrated.shell.windows": "powershell.exe" to settings

This is a VSC’s feature… See https://github.com/microsoft/vscode-cpptools/issues/3718#issue-450942485

Read more comments on GitHub >

github_iconTop Results From Across the Web

The token '&&' is not a valid statement separator in this version
I found that within PowerShell as my terminal within VS Code , replacing && in the command with ; did the trick.
Read more >
The token '||' is not a valid statement separator in this version ...
nodemon isn't installing on my project. Operating system/terminal environment (powershell):; Versions: latest; Command you ran: npm install ...
Read more >
The token '&&' is not a valid statement separator in this version
The token '&&' is not a valid statement separator in this version | Visual Studio error. 8.5K views 1 year ago. Ajay Kumbhar....
Read more >
The token '&&' is not a valid statement separator in this version
Solution to fixing The Token '&&' is not a valid statement separator error seen in the Visual Studio Code terminal and Angular CLI....
Read more >
The token '&&' is not a valid statement separator in this version ...
[Solved]-The token '&&' is not a valid statement separator in this version-Reactjs · score:53. Accepted answer · score:2. I have solved the issue...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found