ls.bat
@echo off
setlocal enabledelayedexpansion
chcp 65001
set p1=%1
set p2=%2
if %p1%=="" (
set p1=%cd%
dir /W %p1%
) else if %p1%=="-l" (
if %p2%=="" (
set p2=%cd%
)
dir %p2%
) else (
dir /W %p1%
)
if %p1%=="" (
set p1=%cd%
dir /W %p1%
goto end
)
endlocal
支持
- ls
- ls -l
- ls folder1
- ls -l folder1
ll.bat
set p1=%1
ls -l %p1%
cat.bat
@echo off
chcp 65001
set filePath=%1
if exist "%filePath%" (
type "%filePath%"
) else (
echo File "%filePath%" not found.
)
grep.bat
@echo off
setlocal enabledelayedexpansion
chcp 65001
set filePath=%~1
set matchWord=%~2
findstr /n %matchWord% %filePath%
endlocal
这样执行cat a.txt|grep aa
、ls|grep nginx
也能支持了
发表评论