PowerShell 語法

# LANG
view raw 1.ps1 hosted with ❤ by GitHub

? is an abreviation of Where-Object

Get-ChildItem "C:\" | ? { $_.PsIsContainer} | ft -AutoSize

% is an abreviation of Foreach

Get-ChildItem "C:\" | % { write-host $_.BaseName}

foreach顯示index

$myObjs = @([PSCustomObject] @{Name="Jack"; Age="10";},
            [PSCustomObject] @{Name="Tom"; Age="15";})
$myObjs | foreach-object{$counter = 0}{
    Write-Host $counter - $_.Name is $_.Age years old.
    $counter++
}

This Is a cat

'This', 'Is', 'a', 'cat' | & {"$input"}

This-Is-a-cat

'This', 'Is', 'a', 'cat' | & {$ofs='-';"$input"}

view raw note.md hosted with ❤ by GitHub

ffmpeg cut

ffmpeg -i input.mp4 -ss 00:01:00 -to 00:02:00 -c copy output.mp4

-i: This specifies the input file. In that case, it is (input.mp4).
-ss: Used with -i, this seeks in the input file (input.mp4) to position.
00:01:00: This is the time your trimmed video will start with.
-to: This specifies duration from start (00:01:40) to end (00:02:12).
00:02:00: This is the time your trimmed video will end with.
-c copy: This is an option to trim via stream copy. (NB: Very fast)

linux - Cutting the videos based on start and end time using ffmpeg - Stack Overflow

view raw note.md hosted with ❤ by GitHub