Motivation:
- You have a source code folder and want to know the number of source lines of code.
- You want to find and replace a string with another string in multiple files.
Procedure:
- Right click Start icon, click on Command Prompt (Admin) or Windows Powershell (Admin)
- Assume that the source code folder location is C:\Users\admin\Downloads\test, type below commands and press Enter
cd C:\Users\admin\Downloads\test
3. Assume that the source code file extension is .py, type below commands and press Enter
type *.py | Measure-Object -line
4. Assume that you want to find and replace “.flac” string with “.wav” string in all .cue files in the “E:\New Music\” directory, type below command, then press Enter.
Get-ChildItem "E:\New Music\" *.cue -recurse | ForEach { (Get-Content -Path $_.FullName).Replace(".flac", ".wav") | Set-Content -Path $_.FullName }
(Visited 893 times, 1 visits today)