Windows Vista Forums
Vista Forums Home Join Vista Forums Donate Vista Tutorials Tags

Welcome to Vista Forums we are your forum to discuss Windows Vista x64 and x86 systems. Whether you need help or just want to post an idea you have on Vista, this is the forum for you.
Register at Vista forums...the world biggest Windows Vista resource Join Vista Forums Now

Go Back   Vista Forums > Microsoft Technical Newsgroups > PowerShell

Newbie alert!

Closed Thread
 
Thread Tools Display Modes
Old 03-21-2007   #1 (permalink)
Axolotl Q Cleaver
Guest


 

Newbie alert!

Although I've done much programming in the (distant) past I would
appreciate five minutes of someone's time to help me get started with
PowerShell.

What I would like to do is pretty simple -
Process each file in a directory using lame to produce a mp3 as follows
lame -h -b 320 4RR_SYN69CD_track01.wav mp3\4RR_SYN69CD_track01.mp3

I'm not sure whether to try to get all the filenames in the directory
and process them to produce a complete script to run against the
directory or whether to try to process the files one at a time - could I
do this starting with Get-ChildItem?

Or am I looking at the wrong tool for the job?

TIA - Martin
Old 03-21-2007   #2 (permalink)
Andrew Savinykh
Guest


 

Re: Newbie alert!

Assuming that you have lame.exe in the current directory and that you've
already created the mp3 subfolder the following should work:

gci *.wav | %{ $in = $_.Name; $out =
[system.io.path]::ChangeExtension($in, "mp3"); ./lame -h -b 320 $in
mp3/$out }

//andrew


Axolotl Q Cleaver wrote:
> Although I've done much programming in the (distant) past I would
> appreciate five minutes of someone's time to help me get started with
> PowerShell.
>
> What I would like to do is pretty simple -
> Process each file in a directory using lame to produce a mp3 as follows
> lame -h -b 320 4RR_SYN69CD_track01.wav mp3\4RR_SYN69CD_track01.mp3
>
> I'm not sure whether to try to get all the filenames in the directory
> and process them to produce a complete script to run against the
> directory or whether to try to process the files one at a time - could I
> do this starting with Get-ChildItem?
>
> Or am I looking at the wrong tool for the job?
>
> TIA - Martin

Old 03-21-2007   #3 (permalink)
Andrew Savinykh
Guest


 

Re: Newbie alert!

This is slightly shorter:

gci *.wav | %{ ./lame -h -b 320 $_.Name "mp3/$($_.Name -replace
'\.wav$','.mp3')" }

Andrew Savinykh wrote:
> Assuming that you have lame.exe in the current directory and that you've
> already created the mp3 subfolder the following should work:
>
> gci *.wav | %{ $in = $_.Name; $out =
> [system.io.path]::ChangeExtension($in, "mp3"); ./lame -h -b 320 $in
> mp3/$out }
>
> //andrew
>
>
> Axolotl Q Cleaver wrote:
>> Although I've done much programming in the (distant) past I would
>> appreciate five minutes of someone's time to help me get started with
>> PowerShell.
>>
>> What I would like to do is pretty simple -
>> Process each file in a directory using lame to produce a mp3 as follows
>> lame -h -b 320 4RR_SYN69CD_track01.wav mp3\4RR_SYN69CD_track01.mp3
>>
>> I'm not sure whether to try to get all the filenames in the directory
>> and process them to produce a complete script to run against the
>> directory or whether to try to process the files one at a time - could
>> I do this starting with Get-ChildItem?
>>
>> Or am I looking at the wrong tool for the job?
>>
>> TIA - Martin

Old 03-21-2007   #4 (permalink)
Axolotl Q Cleaver
Guest


 

Re: Newbie alert!

TVM for both working examples - now I just have to figure out how they
work!!

I've added this to the beginning of the script:
if (!(Test-Path MP3 -PathType Container))
{
new-item -path . -name MP3 -type directory
}

The thing that remains to puzzle me is this:
the path includes c:\windows\system32 which is where lame.exe and its
associated .dll are kept - why does lame have to be in the current
directory?

Sorry to answer your helpful reply with another question!

Best wishes - Martin

Andrew Savinykh wrote:
> This is slightly shorter:
>
> gci *.wav | %{ ./lame -h -b 320 $_.Name "mp3/$($_.Name -replace
> '\.wav$','.mp3')" }
>
> Andrew Savinykh wrote:
>> Assuming that you have lame.exe in the current directory and that
>> you've already created the mp3 subfolder the following should work:
>>
>> gci *.wav | %{ $in = $_.Name; $out =
>> [system.io.path]::ChangeExtension($in, "mp3"); ./lame -h -b 320 $in
>> mp3/$out }
>>

Old 03-21-2007   #5 (permalink)
Andrew Savinykh
Guest


 

Re: Newbie alert!

Axolotl Q Cleaver wrote:
> The thing that remains to puzzle me is this:
> the path includes c:\windows\system32 which is where lame.exe and its
> associated .dll are kept - why does lame have to be in the current
> directory?

It doesn't. I didn't know that you have in on the path, so I assumed
it's in the current folder. If it is on the path, just change './lame'
to 'lame' - should work.
Closed Thread

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
New IM message alert fs_fan Live Messenger 0 07-15-2008 11:13 AM
Alert Help Alert Alert Help Alert this justin1 Gaming 2 04-07-2008 09:33 AM
New Mail Alert Christopher Live Mail 2 03-14-2008 06:19 AM
New Newsgroups Alert? Michelle Vista mail 2 01-29-2008 07:22 AM
Alert! - friends Richard Urban Vista General 8 02-25-2007 02:33 PM








Vistax64.com is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media 2005-2008

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50