May be helpful for someone.
# known bugs
# VLC will not start when file name contains ' or ~ or brackets {} [] ()
#parameters
$inputdir='C:\aju\'
$outputdir='D:\aju\tbm1\ep2\'
#note file extension here!
$files=get-childitem $inputdir *.avi|where-object {!($_.psiscontainer)}
foreach ($file in $files) {
$params=' -vvv '+'"'+$file.fullname+'"'+' --sout=#transcode{vcodec=mp2v,vb=800,scale=1,acodec=mpga,ab=128,channels=2,samplerate=44100,fps=30}:file{dst="'+$outputdir+$file.basename+'.mpeg"'+'}\
:no-sout-rtp-sap :no-sout-standard-sap :ttl=1 :sout-keep vlc://quit'
#H264 vcodec=h264,vb=0,scale=0,acodec=mp4a,ab=128,channels=2,samplerate=44100
#MPEG2 vcodec=mp2v,vb=800,scale=1,acodec=mpga,ab=128,channels=2,samplerate=44100, fps=30
#output just for testing the command line
$params
$process=[Diagnostics.Process]::Start('C:\Program Files (x86)\VideoLAN\VLC\vlc.exe',$params)
do {
Start-Sleep -Second 10
} while (!$process.HasExited)
}
My very first powershell script.
Also I have to mention, that the Powershell is so many much more times better for scripting than CMD. Though comparing to bash it still sucks