1

In VSCode I want to pass the current file name to the integrated terminal There is a setting:

"terminal.integrated.shell.windows": "C:\\WINDOWS\\System32\\WindowsPowerShell\\v1.0\\powershell.exe",

How can I add the current file name, for example this would be great:

"terminal.integrated.shell.windows": "C:\\WINDOWS\\System32\\WindowsPowerShell\\v1.0\\powershell.exe %CurrentFileName%",

Thanks.

Frank Monroe
  • 1,557
  • 2
  • 13
  • 20
  • If you want to use the filename as an argument of a _command_ instead of the whole terminal, see [How to refer to current file from Integrated Terminal in Visual Studio Code](https://stackoverflow.com/q/46004397/711006). – Melebius Apr 26 '21 at 12:01

1 Answers1

1

The shell argument would be in terminal.integrated.shellArgs.powershell

Try and use one of the variables which should be substituted by their actual value

"terminal.integrated.shellArgs.powershell": ["${file}"]
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • I tried and it does not work for me. As the documentation you referenced states: "VS Code supports variable substitution inside strings _in the tasks.json_ file"; this does not seem to apply to shellArgs. Am I missing something? – Frank Monroe Oct 23 '18 at 03:07
  • @FrankMonroe You are not missing much, except an issue on the project to request variable substitution takes place *also* in shellArgs ;) – VonC Oct 23 '18 at 04:31
  • Thanks - would love to know the issue so I can upvote it. – Frank Monroe Oct 23 '18 at 22:10