msys2,使用标准的Windows控制台 [英] msys2, using standard windows console

查看:477
本文介绍了msys2,使用标准的Windows控制台的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用Console2( link1 link2 ),它就像是标准控制台的包装器,但允许使用ctrl-shift-c和ctrl-shift-v复制粘贴文本。我发现它比msys2随附的控制台舒适得多,它们具有ctrl-ins shift-ins怪异的感觉。并且周围有两个不同的控制台不是很好。

I use Console2 (link1 link2), it's like a wrapper around the standard console, but allows to copypaste text with ctrl-shift-c and ctrl-shift-v. I find it much more comfortable than the consoles that come with msys2, they have like ctrl-ins shift-ins weirdness. And having two different consoles around isn't good.

如何使用Console2启动编译器?我将C:\msys64\mingw32\bin添加到PATH,但我不想在PATH中包含太多exe和dll,也不想分发依赖于libgcc_s_dw2-1.dll的东西

How can I use Console2 to launch the compiler? I'd add C:\msys64\mingw32\bin to PATH, but I don't want to have too many exe and dll around in PATH, don't want to distribute something that depends on libgcc_s_dw2-1.dll by accident.

此外,我还需要以某种方式在mingw32和mingw64编译器之间切换。

Also, I need to be able to switch between mingw32 and mingw64 compilers somehow.

读c:/msys64/msys2_shell.cmd,不了解其中的内容。

Tried reading c:/msys64/msys2_shell.cmd, don't understand what's in it.

切换到Windows命令行可能需要从unix shell命令移至Windows命令。我可以重写一些正在使用的makefile,这不是什么大问题。

Switching to windows command line probably requires to move from unix shell commands to windows ones. I could rewrite some makefiles I'm working with, it's not that much of a problem.

也许我可以改用其他方式,在日常生活中使用msys2控制台。我只用它来启动youtube-dl和我写过的其他程序。

Maybe I could go the other way, to use msys2 console in my everyday life. I only use it to launch youtube-dl and one other program I wrote anyway. It would require making copypasting easier, and some way to switch between mingw32 and mingw64.

推荐答案

https://stackoverflow.com/posts/46015587/edit

临时解决方案:创建三个文件 g3.bat g6.bat gg.bat ,然后将它们放在PATH目录之一中。它们允许在PATH中临时添加或删除mingw32或mingw64。

Temporary solution: create three files g3.bat, g6.bat and gg.bat, and put them in one of the PATH directories. They allow to temporarily add or delete mingw32 or mingw64 in PATH.

g3.bat

call gg.bat
SET PATH=%PATH%C:\msys64\mingw32\bin;

g6.bat

call gg.bat
SET PATH=%PATH%C:\msys64\mingw64\bin;

gg.bat

set PATH=%PATH:C:\msys64\mingw32\bin;=%
set PATH=%PATH:C:\msys64\mingw64\bin;=%

调用此命令以检查结果: echo%PATH%

Call this to check the result: echo %PATH%

版本2,尝试不这样做使用前导;

Version 2, that tries to not use leading ;

几乎可以使用,但是 gg.bat 仍然领先; 。我可以使用 set PATH =%PATH:; C:\msys64\mingw32\bin =%来代替(注意额外的; 放在%PATH:)的右侧,但是如果 C:sysmsys64\mingw32\bin 是PATH的开头。

It almost works, but gg.bat still leaves leading ; behind. I could use set PATH=%PATH:;C:\msys64\mingw32\bin=% instead (notice extra ; to the right of %PATH:), but it would break if C:\msys64\mingw32\bin is at the beginning of PATH.

此外,我不确定

g3.bat

call gg.bat
SET PATH=%PATH%;C:\msys64\mingw32\bin

g6.bat

call gg.bat
SET PATH=%PATH%;C:\msys64\mingw64\bin

gg.bat

set PATH=%PATH:C:\msys64\mingw32\bin=%
set PATH=%PATH:C:\msys64\mingw64\bin=%
set "PATH=%PATH:;;=;%"






版本3,无论什么:


Version 3, "eeh whatever":

gg.bat

set PATH=%PATH:;C:\msys64\mingw32\bin=%
set PATH=%PATH:;C:\msys64\mingw64\bin=%

set PATH=%PATH:C:\msys64\mingw32\bin;=%
set PATH=%PATH:C:\msys64\mingw64\bin;=%

set PATH=%PATH:C:\msys64\mingw32\bin=%
set PATH=%PATH:C:\msys64\mingw64\bin=%

set PATH=%PATH:;;=;%

这篇关于msys2,使用标准的Windows控制台的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆