目錄
windows useful cmd
rename one file
rename multiple files
add suffix
cat * | tar -zxv
rm -rf xxx
cp one file to multiple path
windows useful cmd
rename one file
ren old.txt new.txt
rename multiple files
add suffix
If have multiple files(such as txt) in the path, rename all files and add suffix
# Have test.txt, old.txt
# add suffix _new_file
# got new file: test_new_file.txt and old_new_file.txt
for %a in (.\test\*.txt) do ren "%~a" "%~na_new_file%~xa"
for %a in (c:\test\*.txt) do ren "%~a" "%~na_new_file%~xa"
cat * | tar -zxv
将多個分解的包合并解壓

rm -rf xxx
rm: cannot remove ‘test\’: Device or resource busy
# Download handle from https://docs.microsoft.com/en-us/sysinternals/downloads/handle
$ unzip handle.zip
$ ls
handle.exe handle64.exe
$ handle64.exe C:\temp\test
Nthandle v4.22 - Handle viewer
Copyright (C) 1997-2019 Mark Russinovich
Sysinternals - www.sysinternals.com
MobaXterm_Personal_12.3.exe pid: 31680 type: File 900: C:\temp\test
# kill the porcess by cmd or just close the software
$ TASKKILL /F /PID 31680
cp one file to multiple path
windows 使用cmder複制檔案到多個目錄中
# cmder on windows
# tree
λ ls
__init__.py __pycache__ / parsing / reporting / run.py utils/
# copy __init__py to parsing , reporting and utils
# Right way
λ echo parsing reporting utils | xargs - n 1 cp - v __init__.py
'__init__.py' -> 'parsing/__init__.py'
'__init__.py' -> 'reporting/__init__.py'
'__init__.py' -> 'utils/__init__.py'
# Wrong way
λ echo parsing\ reporting\ utils\ | xargs - n 1 cp - v __init__.py
'__init__.py' -> 'parsing reporting utils '$'\r'