Showing posts with label cmd. Show all posts
Showing posts with label cmd. Show all posts

Tuesday, June 26, 2018

cmd: 將windows文件名的空白鍵換成底線

將當前目錄的所有*.txt文件名的空白鍵換成底線︰
cmd /e:on /v:on /c "for %f in ("* *.txt") do (set "n=%~nxf" & set "n=!n: =_!" & ren "%~ff" "!n!" )"

Reference: cmd windows replace spaces with underscores

Tuesday, June 21, 2016

cmd: 找檔案是否包含某一段文字

剛剛在網上找到一個找檔案文字的script,供參考︰
  1. 打開cmd.exe
  2. 到文件目錄中
  3. 輸入以下指令
  4. findStr /M "abc" *
    
    • 第1個參數/M 是設定只輸出文件名
    • 第2個參數“abc”是Pattern
    • 第3個參數是文件