![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
| 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. |
| |||||||
![]() |
| |
| | #1 (permalink) |
| | Run Exe From a CD with wildcard Ive created a script that downloads internet updates (exe files) and then burns then to a cd. What i Want to do is also burn an autorun that runs a script from the cd when the cd is inserted and then runs the exe files from the cd. The problem is the files change name everyday For example one day it will be sdat5555.exe and then the next sdat5556.exe Is there any way i can put a wildcard into my script that will search the cd for any files names starting with sdat and ending in .exe and then install them? |
My System Specs![]() |
| | #2 (permalink) |
| | Re: Run Exe From a CD with wildcard "Oli M" <OliM@xxxxxx> wrote in message news:53C7C7AE-346D-4FAA-B82E-917526BA14BD@xxxxxx Quote: > Ive created a script that downloads internet updates (exe files) and then > burns then to a cd. > > What i Want to do is also burn an autorun that runs a script from the cd > when the cd is inserted and then runs the exe files from the cd. > The problem is the files change name everyday > For example one day it will be sdat5555.exe and then the next sdat5556.exe > > Is there any way i can put a wildcard into my script that will search the > cd > for any files names starting with sdat and ending in .exe and then install > them? them" or "execute them". If so then you could get autorun to invoke the following batch file: @echo off for /F "delims=" %%a in ('dir /b /s \sdat*.exe') do "%%a" Do not retype this batch file - use copy & paste instead! |
My System Specs![]() |
| | #3 (permalink) |
| | Re: Run Exe From a CD with wildcard Thanks very much. I don't want to do it in a batch file though, as the vbs script I have does other things as well and I want it all in one script. Is there anyway of doing that in a vbs script? "Pegasus [MVP]" wrote: Quote: > > "Oli M" <OliM@xxxxxx> wrote in message > news:53C7C7AE-346D-4FAA-B82E-917526BA14BD@xxxxxx Quote: > > Ive created a script that downloads internet updates (exe files) and then > > burns then to a cd. > > > > What i Want to do is also burn an autorun that runs a script from the cd > > when the cd is inserted and then runs the exe files from the cd. > > The problem is the files change name everyday > > For example one day it will be sdat5555.exe and then the next sdat5556.exe > > > > Is there any way i can put a wildcard into my script that will search the > > cd > > for any files names starting with sdat and ending in .exe and then install > > them? > In your last paragraph you write "install them". Presumably you mean "run > them" or "execute them". If so then you could get autorun to invoke the > following batch file: > > @echo off > for /F "delims=" %%a in ('dir /b /s \sdat*.exe') do "%%a" > > Do not retype this batch file - use copy & paste instead! > > > |
My System Specs![]() |
| | #4 (permalink) |
| | Re: Run Exe From a CD with wildcard "Oli M" <OliM@xxxxxx> wrote in message news:6F3A461D-7D12-45F1-9165-21C0C9307D93@xxxxxx Quote: > Thanks very much. > > I don't want to do it in a batch file though, as the vbs script I have > does > other things as well and I want it all in one script. > > Is there anyway of doing that in a vbs script? > sdat*.exe, then use the Run method to execute the file you find. It's the same idea but it probably takes ten lines of code instead of one. |
My System Specs![]() |
| | #5 (permalink) |
| | Re: Run Exe From a CD with wildcard Ah ok. One small thing. I would I got about doing that ![]() What would the ten lines of code be. Im still a newbie at this "Pegasus [MVP]" wrote: Quote: > > "Oli M" <OliM@xxxxxx> wrote in message > news:6F3A461D-7D12-45F1-9165-21C0C9307D93@xxxxxx Quote: > > Thanks very much. > > > > I don't want to do it in a batch file though, as the vbs script I have > > does > > other things as well and I want it all in one script. > > > > Is there anyway of doing that in a vbs script? > > > Sure - use the File System Object to search all CD folders recursively for > sdat*.exe, then use the Run method to execute the file you find. It's the > same idea but it probably takes ten lines of code instead of one. > > > |
My System Specs![]() |
| | #6 (permalink) |
| | Re: Run Exe From a CD with wildcard "Oli M" <OliM@xxxxxx> wrote in message news:1ABFE01F-C72A-4B5B-9876-D9A801A7AEA1@xxxxxx Quote: > Ah ok. One small thing. > I would I got about doing that ![]() > > What would the ten lines of code be. > > Im still a newbie at this operation is fairly easy to understand), then you request a full VB Script solution because you do not yet have the experience to write the code in this language of your choice. This wouldn't be a study course assignment, would it? Here is the recursive part of the solution. You must invoke it with cscript.exe. Set oFSO = CreateObject("Scripting.FileSystemObject") Set oFolder = oFSO.GetFolder("F:\") GetFiles(oFolder) Sub GetFiles(oFldr) For Each oFile In oFldr.Files WScript.Echo oFile.path Next For Each oSubFolder In oFldr.Subfolders GetFiles(oSubFolder) Next End Sub You can use it as the basis for the remaining tasks, i.e. - Pick the files that match your wildcard spec; - Use the Run method to invoke the executable you found. You will find everything you need in the downloadable help file script56.chm. Look for the "left" and "right" functions and for the "run" or "exec" methods. |
My System Specs![]() |
| | #7 (permalink) |
| | Re: Run Exe From a CD with wildcard Pegasus [MVP] schrieb: Quote: > "Oli M" <OliM@xxxxxx> wrote in message > news:1ABFE01F-C72A-4B5B-9876-D9A801A7AEA1@xxxxxx Quote: > Here is the recursive part of the solution. You must invoke it with > cscript.exe. > > Set oFSO = CreateObject("Scripting.FileSystemObject") > Set oFolder = oFSO.GetFolder("F:\") > GetFiles(oFolder) > > Sub GetFiles(oFldr) > For Each oFile In oFldr.Files > WScript.Echo oFile.path > Next > For Each oSubFolder In oFldr.Subfolders > GetFiles(oSubFolder) > Next > End Sub > > You can use it as the basis for the remaining tasks, i.e. > - Pick the files that match your wildcard spec; > - Use the Run method to invoke the executable you found. > > You will find everything you need in the downloadable help file > script56.chm. Look for the "left" and "right" functions and for the "run" or > "exec" methods. Const csCDRoot = "<YourCDRoot>" Dim oFSO : Set oFSO = CreateObject( "Scripting.FileSystemObject" ) Dim oWSH : Set oWSH = CreateObject( "WScript.Shell" ) Dim oRE : Set oRE = New RegExp oRE.IgnoreCase = True oRE.Pattern = "^sdat\d+\.exe$" ' <== sdat5555.exe and then the next sdat5556.exe ExecCDFiles oFSO.GetFolder( csCDRoot ), oFSO, oRE, oWSH Sub ExecCDFiles( oFldr, oFSO, oRE, oWSH ) Dim oItem For Each oItem In oFldr.Files WScript.Echo "seen ", oItem.Path If oRE.Test( oItem.Name ) Then WScript.Echo "match", oItem.Path End If Next For Each oItem In oFldr.Subfolders ExecCDFiles oItem, oFSO, oRE, oWSH Next End Sub [I admit that I did it mainly to remove those nasty () from Pegasus' code] |
My System Specs![]() |
| | #8 (permalink) |
| | Re: Run Exe From a CD with wildcard Pegasus [MVP] schrieb: Quote: > "Oli M" <OliM@xxxxxx> wrote in message > news:1ABFE01F-C72A-4B5B-9876-D9A801A7AEA1@xxxxxx Quote: > Here is the recursive part of the solution. You must invoke it with > cscript.exe. > > Set oFSO = CreateObject("Scripting.FileSystemObject") > Set oFolder = oFSO.GetFolder("F:\") > GetFiles(oFolder) > > Sub GetFiles(oFldr) > For Each oFile In oFldr.Files > WScript.Echo oFile.path > Next > For Each oSubFolder In oFldr.Subfolders > GetFiles(oSubFolder) > Next > End Sub > > You can use it as the basis for the remaining tasks, i.e. > - Pick the files that match your wildcard spec; > - Use the Run method to invoke the executable you found. > > You will find everything you need in the downloadable help file > script56.chm. Look for the "left" and "right" functions and for the "run" or > "exec" methods. Const csCDRoot = "<YourCDRoot>" Dim oFSO : Set oFSO = CreateObject( "Scripting.FileSystemObject" ) Dim oWSH : Set oWSH = CreateObject( "WScript.Shell" ) Dim oRE : Set oRE = New RegExp oRE.IgnoreCase = True oRE.Pattern = "^sdat\d+\.exe$" ' <== sdat5555.exe and then the next sdat5556.exe ExecCDFiles oFSO.GetFolder( csCDRoot ), oFSO, oRE, oWSH Sub ExecCDFiles( oFldr, oFSO, oRE, oWSH ) Dim oItem For Each oItem In oFldr.Files WScript.Echo "seen ", oItem.Path If oRE.Test( oItem.Name ) Then WScript.Echo "match", oItem.Path End If Next For Each oItem In oFldr.Subfolders ExecCDFiles oItem, oFSO, oRE, oWSH Next End Sub [I admit that I did it mainly to remove those nasty () from Pegasus' code] |
My System Specs![]() |
| | #9 (permalink) |
| | Re: Run Exe From a CD with wildcard "ekkehard.horner" <ekkehard.horner@xxxxxx> wrote in message news:49E4BEC9.80808@xxxxxx Quote: > Pegasus [MVP] schrieb: Quote: >> "Oli M" <OliM@xxxxxx> wrote in message >> news:1ABFE01F-C72A-4B5B-9876-D9A801A7AEA1@xxxxxx Quote: >> Here is the recursive part of the solution. You must invoke it with >> cscript.exe. >> >> Set oFSO = CreateObject("Scripting.FileSystemObject") >> Set oFolder = oFSO.GetFolder("F:\") >> GetFiles(oFolder) >> >> Sub GetFiles(oFldr) >> For Each oFile In oFldr.Files >> WScript.Echo oFile.path >> Next >> For Each oSubFolder In oFldr.Subfolders >> GetFiles(oSubFolder) >> Next >> End Sub >> >> You can use it as the basis for the remaining tasks, i.e. >> - Pick the files that match your wildcard spec; >> - Use the Run method to invoke the executable you found. >> >> You will find everything you need in the downloadable help file >> script56.chm. Look for the "left" and "right" functions and for the "run" >> or "exec" methods. > Ok, I'll add the the 'find the .exe' sub part of the problem: > > Const csCDRoot = "<YourCDRoot>" > > Dim oFSO : Set oFSO = CreateObject( "Scripting.FileSystemObject" ) > Dim oWSH : Set oWSH = CreateObject( "WScript.Shell" ) > Dim oRE : Set oRE = New RegExp > oRE.IgnoreCase = True > oRE.Pattern = "^sdat\d+\.exe$" ' <== sdat5555.exe and then the next > sdat5556.exe > ExecCDFiles oFSO.GetFolder( csCDRoot ), oFSO, oRE, oWSH > > Sub ExecCDFiles( oFldr, oFSO, oRE, oWSH ) > Dim oItem > For Each oItem In oFldr.Files > WScript.Echo "seen ", oItem.Path > If oRE.Test( oItem.Name ) Then > WScript.Echo "match", oItem.Path > End If > Next > For Each oItem In oFldr.Subfolders > ExecCDFiles oItem, oFSO, oRE, oWSH > Next > End Sub > > [I admit that I did it mainly to remove those nasty () from Pegasus' code] own? He prefers to get the lot delivered on a platter, free of charge, with no effort by himself other than holding out his hollow hand. |
My System Specs![]() |
| | #10 (permalink) |
| | Re: Run Exe From a CD with wildcard Pegasus [MVP] schrieb: [...] Quote: > Did you notice that the OP did not contribute a single line of code of his > own? He prefers to get the lot delivered on a platter, free of charge, with > no effort by himself other than holding out his hollow hand. put some effort/work into the problem that could well be the base for a complete solution. At least, one can hope that Oli M will add the 'execute' part of the task. If not, perhaps some other person will chip in some lines of code (just for fun or out of generosity). Then this topic will end well, even though it started badly. |
My System Specs![]() |
![]() |
| Thread Tools | |
| |
Similar Threads | ||||
| Thread | Forum | |||
| Change filename using a wildcard | VB Script | |||
| The specified wildcard pattern is not valid: [ | PowerShell | |||
| how to get the file name from using a wildcard | VB Script | |||
| WildCard SSL Certificates | Vista mail | |||
| Wildcard searches | Vista file management | |||