Saved Bookmarks
| 1. |
Solve : Need help creating a batch file with .wvx extension? |
|
Answer» Background I have a number of WMV files on my website's server and Im creating two sets of links to them. One for instant viewing and the other for downloading it. Creating the download link is easy since its just a link with the full path name (webserver/path/filename.wmv). For the streaming link, I have a "director file" with a .wvx extension which is simply a text file with a short script in it that tells the client PC to execute windows media player to play said wmv file. The *.wvx text file has the following string in it: http://YourWebServer/Path/YourFile.wmv" /> The Task I would like to create a BATCH file that can create a *.wvx file for each of the *.wmv files on the drive. The newly created wvx should have the same name as the wmv file (just different extensions) and also inside the *.wvx should reference to the wmv file on the server. I hope this makes sense. My attempt for %%a IN (*.wmv) do echo " http://Mywebserver/path/%%~na.wmv"/> " > %%~na.wvx I've come up with this string and it does everything for the most parts, but it list the entire string on one line but as you can see in the above example, the string is suppose to be on 5 lines. or the link doesn't work. I know bearly anything about batch files commands so any help will be welcomed @echo off For /f "delims=." %%a in ('dir /b /s PATHTOFILES*.wmv') do ( Echo %%a Echo ^ > %%a.wvx echo ^ >> %%a.wvx echo ^ >> %%a.wvx echo ^ >> %%a.wvx echo ^ >> %%a.wvx ) That should work. I haven't tested it though. If I understand what you want, it is not worthwhile doing it in batch. This kind of job could be DONE in some kind of HTML page with some code for either doing a down load or STARTING a stream. I tried your code Helpmeh, but it didn't work, it didn't even create a .wvx file I substituted ('dir /b /s PATHTOFILES*.wmv') for ('*.wmv') since I placed the batch file in the same directory as the wmv files. But no avail. I'm not familar with any HTML code for creating a metafile for wmv files Geek-9pm, but i'm listening natedj, Does anyone know what you are talking about or what you are trying to do?I though I was clear in the topic but in a nutshell. I need to create a text file to point to a WMV file on my website. (why? .... because linking to it offer a download option in some browers and not actually playing/streaming the file) I've be creating these files manualy i.e. create one, do a "save as", change the file name (thats inside of the string) to the newly target file and so on This is the text file string that is in each .wvx file http://YourWebServer/Path/YourFile.wmv" /> I then save this text file with a .wvx extension. Why do I want a batch file for this ... I have a ton of wmv files that need wvx files to point to them. Where id i get the idea from? http://www.microsoft.com/windows/windowsmedia/howto/articles/webserver.aspx#webserver_topic3 Code: [Select]Set objFS=CreateObject("Scripting.FileSystemObject") strFolder = "c:\test" Set objFolder = objFS.GetFolder(strFolder) For Each strFile In objFolder.Files If objFS.GetExtensionName(strFile) = "wmv" Then strBaseName = objFS.GetBaseName(strFile) strFileName = Replace(strFile.Name," ","%20") WScript.Echo strFileName, strBaseName strNewFileName = strBaseName & ".wvx" Set objOut = objFS.CreateTextFile(strNewFileName,True) objOut.WriteLine("<ASX VERSION=""3.0"">") objOut.WriteLine(" ENTRY") objOut.WriteLine("<REF HREF=""http://YourWebServer/Path/" & strFileName & """" & "/>") objOut.Close End If Next output Code: [Select]c:\test> cscript /nologo myscript.vbs I have read over the reference you gave. That looks cool. You can also use Flash player, but that is another story. The issue is your web site does not support real time streaming of video, so the thing from Microsoft with help WMA do a better job and avoid a broken stream. So you want to create the HTML stuff automatically on you PC and then load the files to your site. OK. Now I get it. I used to do that sort of thin when I have a number of sites that I want to have ALMOST the same code on each site but just a few changes from an list. And I did it with a batch file and then uploaded the changed files to my sites. I I did that with batch also. So yea, you can do that. You can do that with a FOR loop. Some of the others here will tell you how to use FOR to substitute the text in a number of files. I am a FOR loop flunky, so I would just create a batch files that would pass a list of names to another batch file to process the text. I had to INCORPORATE a program into the batch that would do the actual text substitution. Never could understand how FOR does that, just easier for me to write a program that opens a file, substitute from a list and writes a new copy of the file to a directory. The vbs thing is what you could use, but I used QBASIC, more primitive, but does the job. |
|