[PYTHON] I want to do automatic command macro file writing while using Anaconda Prompt with Atom!

0. Overview

Here, when operating the terminal on Atom using the platformio-ide-terminal package, "set the default terminal to Anaconda Prompt" and "write the command macro file automatically when the terminal starts" are executed at the same time. The solution to do so is summarized.

1. Background

Atom is a very flexible editor that allows you to customize the environment to your liking by installing various packages. I haven't started using it yet, but I'm already captivated by its ease of use.

One of my favorite packages in this package is platformio-ide-terminal </ font>. Thanks to this, the complicated switching between the terminal and the editor is eliminated, and everything can be completed by the operation on the editor.

Since it was necessary to use Anaconda in the development environment that we are going to build, we set the default terminal on Atom to Anaconda Prompt according to the setting method on the reference page below.

Reference URL: https://qiita.com/daizutabi/items/6e4e7042b764b61adf27

2. Environment

OS:Windows10 Enterprise 1809 64bit Atom:1.47.0 platformio-ide-terminal 2.10.0 Anaconda Navigater 1.9.12

3. Trouble

Well, there was a problem here. This is because, recently, the number of terminal operations in the Linux OS environment has increased, so on the command prompt, I used a command macro file that was set so that Linux-like terminal commands could be used. (For the command macro, please refer to the following page for the front miso.)

See; https://qiita.com/titanium0715/items/8bbad95f939017302d38

In the above reference page, it was supported by adding the k option on the shortcut property of the command prompt. However, in Atom, cmd.exe is read directly without going through a shortcut, so the above solution cannot be used. So, to solve this, from the platformio-ide-terminal setting, set Auto Run Command to ① </ font> `` `doskey / macrofile = C: \ {Private Path} \ You need to set {command macro file} .txt```.

↓ ↓ ↓ Reference diagram ↓ ↓ ↓ 無題.png

However, as you can see in the reference URL mentioned in 1. Background, in order to run Anaconda Prompt on Atom, ② </ font> `` `in Auto Run Command You need to write {Private Path} \ {miniconda or Anaconda} \ Scripts \ activate.bat root```.

I want to set macro files while using Anaconda Prompt on Atom. Then you should write both ① </ font> and ② </ font>! I thought, but simply arranging them side by side did not work because the terminal did not start up on Atom or only one of the instructions passed.

4. Solution

As a result of various trials, I was able to reflect both settings by writing the Auto Run Command in the following format!

doskey / macrofile = C: {Private Path 1} \ {command macro file} .txt & C: {Private Path 1} \ Anaconda3 \ Scripts \ activate.bat root </ font>

The point is "__ connect two commands with" & "", and then " write in the order of ①⇒②__". I was very worried about the order, and when I was writing in the order of ②⇒①, I couldn't make the proper settings no matter what I did. After that, be careful.         If I knew the grammar of the batch file, I might not have had such a hard time.

Recommended Posts