Forum Discussion

Aidy's avatar
Aidy
Occasional Contributor
15 years ago

Running a setup file from most recent folder

How would I write a script that could run each morning and run a file from the most recent subfolder within another folder?



E.g. If I had a folder called c:\builds\ and within that I had a new folder was created each morning containing that days build, which I wanted to run, along the lines of c:\builds\10Oct2010\Setup.exe



How would I write a script that could run the latest build each morning?



Thanks in advace.

1 Reply


  • Hi,





    You need to iterate through all subdirectories in 'c:\builds' (see the "Processing Files in a Folder" help topic) and find the needed one by some criteria (for example, by name or creation date). Once you find the needed directory, obtain the 'setup.exe' path (you can simply add 'setup.exe' to the current directory path) and run it either by using the WScript.Shell Run method or by changing the path in TestedApps.