用惯了linux中的make和ls命令,在windows上开发时,即使使用了wsl子系统,有时候在IDE开发工具和cmd终端中直接使用make和ls命令。下面将介绍如何在windows上安装和使用make和ls
下载地址:[Download MinGW - Minimalist GNU for Windows](http://sourceforge.net/projects/mingw/files/latest/download?source=files)
下载后安装,默认安装到C:\MinGW,安装完成后到C:\MinGW\bin目录,双击打开mingw-get.exe
找到mingw32-make相关,选择这4项后右键Mark for installtion
点击左上角Installation-Update Catalogue, Applay等待安装完成后点击Close
打开MinGW的安装目录,打开bin文件夹,将mingw32-make.exe
重命名为make.exe
右击计算机->属性->高级系统设置->环境变量,在系统变量中找到PATH
新建C:\MinGW\bin
新打开cmd命令行,执行make -v
C:\Users\Administrator>make -v
GNU Make 3.82.90
Built for i686-pc-mingw32
Copyright (C) 1988-2012 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
C:\Users\Administrator>
在IDE中后续就可以直接通过点击按钮实现make功能,避免切换wsl系统和省去敲写代码
windows中ls不是内部命令,要查看当前目录下的文件和子目录可通过dir命令查看。
桌面右键新建文本重命名为ls.bat
,里面输入以下内容
@echo off
dir
将ls.bat文件拖到Windows根目录下(例如C:\Windows\System32\
)
重新打开命令行窗口,输入ls就可以看到文件列表了
PS F:\装机\K8S> ls
目录: F:\装机\K8S
Mode LastWriteTime Length Name
---- ------------- ------ ----
d----- 2024/7/1 17:50 ARM
d----- 2024/9/25 19:15 ks3.4.1
d----- 2024/9/30 15:42 ks3.4.1-new
d----- 2024/7/5 9:29 log
d----- 2024/7/16 14:36 X86
d----- 2024/9/30 15:38 x86-centos
d----- 2024/8/5 11:54 海光+麒麟
d----- 2024/9/26 14:19 鲲鹏+麒麟
-a---- 2024/7/4 13:10 621911 arm.png
-a---- 2024/7/5 9:32 4402 log.zip
-a---- 2024/8/5 16:26 813195684 opensearch.tar.gz
-a---- 2024/8/5 16:20 12901 opensearch.zip
PS F:\装机\K8S>