OiO.lk Community platform!

Oio.lk is an excellent forum for developers, providing a wide range of resources, discussions, and support for those in the developer community. Join oio.lk today to connect with like-minded professionals, share insights, and stay updated on the latest trends and technologies in the development field.
  You need to log in or register to access the solved answers to this problem.
  • You have reached the maximum number of guest views allowed
  • Please register below to remove this limitation

Automatically type command in powershell in visual studio code

  • Thread starter Thread starter 温泽海
  • Start date Start date

温泽海

Guest
I have a conda project with visual studio code. I wish that, every time in the project folder when I open my powershell, the command conda activate v_env is executed automatically. From the answer here, VSCode: How to run a command after each terminal open?, I create a json document :

Code:
{
    "terminal.integrated.profiles.windows": {
      "My PowerShell": {
        "path": "pwsh.exe",
        "args": ["-noexit", "-file", "conda activate v_env"]
      }
    },
    "terminal.integrated.defaultProfile.windows": "My PowerShell"
}

I tried:

  1. Name the file settings.json and put it in .vscode.
  2. Name the file tasks.json and put it in .vscode.

But neither of the two works. When I open powershell, it is like nothing was typed. I believe that this is because I did not put the json at a correct location or I did not use the script correctly. How do I proceed?
<p>I have a conda project with visual studio code. I wish that, every time in the project folder when I open my powershell, the command <code>conda activate v_env</code> is executed automatically. From the answer here, <a href="https://stackoverflow.com/questions/45635168/vscode-how-to-run-a-command-after-each-terminal-open">VSCode: How to run a command after each terminal open?</a>, I create a json document :</p>
<pre><code>{
"terminal.integrated.profiles.windows": {
"My PowerShell": {
"path": "pwsh.exe",
"args": ["-noexit", "-file", "conda activate v_env"]
}
},
"terminal.integrated.defaultProfile.windows": "My PowerShell"
}
</code></pre>
<p>I tried:</p>
<ol>
<li>Name the file <code>settings.json</code> and put it in <code>.vscode</code>.</li>
<li>Name the file <code>tasks.json</code> and put it in <code>.vscode</code>.</li>
</ol>
<p>But neither of the two works. When I open powershell, it is like nothing was typed. I believe that this is because I did not put the json at a correct location or I did not use the script correctly. How do I proceed?</p>
Continue reading...
 

Latest posts

I
Replies
0
Views
1
impact christian
I
Top