A sample
If you want to do something like processing a lot of files at Windows. Maybe powershell script is a alternative choice.
Here I wrote a simple powershell script.
foreach($file in (ls *.cpp)) {
write-host $file
$source = "$file"
$target = $source.Replace(".cpp", ".cc")
// Do some processing...
}
foreach .. in ..
like the for
in other languages.
ls *.cpp
will list all the files in the current directory with suffix .cpp
. Alternatively you can do something like this to count the number of files of the result ls
.
(ls *.cpp).Count
write-host
would like output some log in the console.
Replace
can replace the string at first parameter with the second parameter.
Remove file
Remove-Item $path
Check if file exist
Test-Path $path