Windows Vista Forums
Vista Forums Home Join Vista Forums Windows 7 Forum Vista Tutorials Tags
Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks.

Go Back   Vista Forums > Misc Newsgroups > VB Script

Vista - Run Command Line

Reply
 
Old 4 Weeks Ago   #1 (permalink)
Jing Software


 
 

Run Command Line

Hello,

I am trying to run a vbs file on my server that appends a few mp3
files to another and creates a new file.

I can do this from the command line without out any problems:

copy /b D:\Sites\www\applications\recorder\file1.mp3 + D:\Sites\www
\applications\recorder\file2.mp3 D:\Sites\www\applications\recorder
\new.mp3

When I try this in a vbs file or asp file it just hangs in asp and in
the vbs I get the message "cannot find the file specified"

Dim oShell, sCommand
sCommand = "copy /b D:\Sites\www\applications\recorder\file1.mp3 + D:
\Sites\www\applications\recorder\file2.mp3 D:\Sites\www\applications
\recorder\new.mp3"
Set oShell = CreateObject("WScript.Shell")
oShell.Run sCommand, , True
Set oShell = Nothing

Any ideas on what I could be doing wrong?

Thanks

James

My System SpecsSystem Spec
Old 4 Weeks Ago   #2 (permalink)
Pegasus [MVP]


 
 

Re: Run Command Line


"Jing Software" <jingprojects@newsgroup> wrote in message
news:31de4b06-1a71-4756-b9eb-52794feb3da6@newsgroup
Quote:

> Hello,
>
> I am trying to run a vbs file on my server that appends a few mp3
> files to another and creates a new file.
>
> I can do this from the command line without out any problems:
>
> copy /b D:\Sites\www\applications\recorder\file1.mp3 + D:\Sites\www
> \applications\recorder\file2.mp3 D:\Sites\www\applications\recorder
> \new.mp3
>
> When I try this in a vbs file or asp file it just hangs in asp and in
> the vbs I get the message "cannot find the file specified"
>
> Dim oShell, sCommand
> sCommand = "copy /b D:\Sites\www\applications\recorder\file1.mp3 + D:
> \Sites\www\applications\recorder\file2.mp3 D:\Sites\www\applications
> \recorder\new.mp3"
> Set oShell = CreateObject("WScript.Shell")
> oShell.Run sCommand, , True
> Set oShell = Nothing
>
> Any ideas on what I could be doing wrong?
>
> Thanks
>
> James
You're not really doing this in VB Script - you're shelling out to a console
session and you then have the usual problems with placing the correct number
double-quotes around your file names. A cleaner solution would be to do the
whole lot with VB Script commands, e.g. like so:

sName1 = "D:\Sites\www\applications\recorder\file1.mp3"
sName2 = "D:\Sites\www\applications\recorder\file2.mp3"
sName3 = "D:\Sites\www\applications\recorder\New.mp3"
Set oFSO = CreateObject("Scripting.FileSystemObject")
iSize1 = oFSO.GetFile(sName1).Size
iSize2 = oFSO.GetFile(sName2).Size
sFile1 = oFSO.OpenTextFile(sName1,1,False).Read(iSize1)
sFile2 = oFSO.OpenTextFile(sName2,1,False).Read(iSize2)
Set oFile3 = oFSO.CreateTextFile(sName3, True, False)
oFile3.Write sFile1
oFile3.Write sFile2
oFile3.Close

By the way - are you sure that you can append .mp3 files to each other like
thim and get them to be processed correctly by your media player? What about
the header information?


My System SpecsSystem Spec
Old 3 Weeks Ago   #3 (permalink)
Jing Software


 
 

Re: Run Command Line

On Nov 6, 2:36*pm, "Pegasus [MVP]" <n...@newsgroup> wrote:
Quote:

> "Jing Software" <jingproje...@newsgroup> wrote in message
>
> news:31de4b06-1a71-4756-b9eb-52794feb3da6@newsgroup
>
>
>
>
>
Quote:

> > Hello,
>
Quote:

> > I am trying to run a vbs file on my server that appends a few mp3
> > files to another and creates a new file.
>
Quote:

> > I can do this from the command line without out any problems:
>
Quote:

> > copy /b D:\Sites\www\applications\recorder\file1.mp3 + D:\Sites\www
> > \applications\recorder\file2.mp3 D:\Sites\www\applications\recorder
> > \new.mp3
>
Quote:

> > When I try this in a vbs file or asp file it just hangs in asp and in
> > the vbs I get the message "cannot find the file specified"
>
Quote:

> > Dim oShell, sCommand
> > sCommand = "copy /b D:\Sites\www\applications\recorder\file1.mp3 + D:
> > \Sites\www\applications\recorder\file2.mp3 D:\Sites\www\applications
> > \recorder\new.mp3"
> > Set oShell = CreateObject("WScript.Shell")
> > oShell.Run sCommand, , True
> > Set oShell = Nothing
>
Quote:

> > Any ideas on what I could be doing wrong?
>
Quote:

> > Thanks
>
Quote:

> > James
>
> You're not really doing this in VB Script - you're shelling out to a console
> session and you then have the usual problems with placing the correct number
> double-quotes around your file names. A cleaner solution would be to do the
> whole lot with VB Script commands, e.g. like so:
>
> sName1 = "D:\Sites\www\applications\recorder\file1.mp3"
> sName2 = "D:\Sites\www\applications\recorder\file2.mp3"
> sName3 = "D:\Sites\www\applications\recorder\New.mp3"
> Set oFSO = CreateObject("Scripting.FileSystemObject")
> iSize1 = oFSO.GetFile(sName1).Size
> iSize2 = oFSO.GetFile(sName2).Size
> sFile1 = oFSO.OpenTextFile(sName1,1,False).Read(iSize1)
> sFile2 = oFSO.OpenTextFile(sName2,1,False).Read(iSize2)
> Set oFile3 = oFSO.CreateTextFile(sName3, True, False)
> oFile3.Write sFile1
> oFile3.Write sFile2
> oFile3.Close
>
> By the way - are you sure that you can append .mp3 files to each other like
> thim and get them to be processed correctly by your media player? What about
> the header information?- Hide quoted text -
>
> - Show quoted text -
Thanks for this, it works great. MP3 Files can be appended in this
manner, there are problems with the meta information as it all gets
merged but the files still play in itunes and media player, I
understand that there will be problems with the ipod though. I guess
the only way to inject the header information will be by using a media
program from the command line which will remove the old header
information and inject the details of the new file. Unless VB Script
capable of injecting the file header information into the file ?

I guess if it has to be a command line solution then I will hit this
issue with quotations you mention when trying to run it.

Thanks

James
My System SpecsSystem Spec
Reply

Thread Tools


Similar Threads
Thread Forum
Running a command from inside a script, command line is corrupted PowerShell
command line Vista General
What is the command line command for unzipping files? Vista General
Command Line Ren (Rename) command broken? Vista General
XP command line Vista networking & sharing


Vista Forums 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 Ltd

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