asifm Posted April 2, 2013 Posted April 2, 2013 Hi, I need vbs or batch file which can run number of .exe present within a folder. For example the all exe present in C:\AMB folder, the AMB folder contains many installable folders, and in that exe are present i.e. C:\AMB\installable\abc.exe ,C:\AMB\installable_1\abc.exe. All exe are having same naming convention. abc.exe Can someone please help me out in this project. Thanks in Advance!!!
Grey-gear Posted April 2, 2013 Posted April 2, 2013 (edited) You would just need to have something like RUN ("C:\AMB\installable\abc.exe") for each exe you want to run. Edited April 2, 2013 by Grey-gear
TechSupp Posted April 2, 2013 Posted April 2, 2013 Wouldnt you also need to set it to wait till one had finished before starting the next one.
asifm Posted April 2, 2013 Author Posted April 2, 2013 Hi Grey-gear, But i need to run each and every .exe whic is present inside C:\AMB\ folder. Actually i have a setup which ask a license file and then directory where to install, when this setup is completed. Then around 20 plugins which are executables (exe) needs to be installed inside the above ran setup. I want to do automation for this process. Can you please write such script? Thanks,
kevvo2000 Posted April 2, 2013 Posted April 2, 2013 Hi Grey-gear, But i need to run each and every .exe whic is present inside C:\AMB\ folder. Actually i have a setup which ask a license file and then directory where to install, when this setup is completed. Then around 20 plugins which are executables (exe) needs to be installed inside the above ran setup. I want to do automation for this process. Can you please write such script? Thanks, Hi, Try this one..... '####### Start ###### '# Run Exe Files in Specified folder and Subfolder '# Kevin Burke - 04-04-2013 Set objFSO = CreateObject("Scripting.FileSystemObject") objStartFolder = "C:\AMB" Set objFolder = objFSO.GetFolder(objStartFolder) 'Wscript.Echo objFolder.Path Set colFiles = objFolder.Files For Each objFile in colFiles 'Wscript.Echo objFile.Name Next 'Wscript.Echo ShowSubfolders objFSO.GetFolder(objStartFolder) Sub ShowSubFolders(Folder) For Each Subfolder in Folder.SubFolders 'Wscript.Echo Subfolder.Path Set objFolder = objFSO.GetFolder(Subfolder.Path) Set colFiles = objFolder.Files Set objShell = WScript.CreateObject("WScript.Shell") For Each objFile in colFiles if instr(objFile.Name,".exe") then Wscript.Echo Subfolder.Path &"\"& objFile.Name objShell.Run objFile.Name, 1, true end if Next 'Wscript.Echo ShowSubFolders Subfolder Next End Sub '#####End##### 1
asifm Posted April 2, 2013 Author Posted April 2, 2013 Hi Kevin, I think this code is written in java, can i have something same in commandline (batch file). Thanks.
asifm Posted April 2, 2013 Author Posted April 2, 2013 I need script something like this one below; only the change i want is instead of giving each YepPIInstall.exe path i want to execute all the exe's at once which are in "C:\Plugins" directory. @echo off set /P _license file=License file path: set /P _directory=New Test Install Directory: cd\ cd "C:\Plugins\AD_PLUGIN_INST" YepPIInstall.exe /qs C:\Test70.log /L "%_license file%" /d "%_directory%" cd "C:\Plugins\COMM_PLUGIN_INST" YepPIInstall.exe /qs C:\Test70.log /L "%_license file%" /d "%_directory%" cd "C:\Plugins\CORR_PLUGIN_INST" YepPIInstall.exe /qs C:\Test70.log /L "%_license file%" /d "%_directory%" IISRESET
TechSupp Posted April 2, 2013 Posted April 2, 2013 Looks like vbs to me. Does the above wait for one to finish before starting the next as it could very well sort a similar thing for me that has just cropped up.
SovietRussia Posted April 2, 2013 Posted April 2, 2013 Hi Kevin, I think this code is written in java, can i have something same in commandline (batch file). Thanks. That code is VBS
TechSupp Posted April 2, 2013 Posted April 2, 2013 Ah! Just googled the run command and see you set the option to wait till finished, brilliant, thanks, job sorted for me anyway :-)
kevvo2000 Posted April 2, 2013 Posted April 2, 2013 Hi, Try this one..... '####### Start ###### '# Run Exe Files in Specified folder and Subfolder '# Kevin Burke - 04-04-2013 Set objFSO = CreateObject("Scripting.FileSystemObject") objStartFolder = "C:\AMB" Set objFolder = objFSO.GetFolder(objStartFolder) 'Wscript.Echo objFolder.Path Set colFiles = objFolder.Files For Each objFile in colFiles 'Wscript.Echo objFile.Name Next 'Wscript.Echo ShowSubfolders objFSO.GetFolder(objStartFolder) Sub ShowSubFolders(Folder) For Each Subfolder in Folder.SubFolders 'Wscript.Echo Subfolder.Path Set objFolder = objFSO.GetFolder(Subfolder.Path) Set colFiles = objFolder.Files Set objShell = WScript.CreateObject("WScript.Shell") For Each objFile in colFiles if instr(objFile.Name,".exe") then Wscript.Echo Subfolder.Path &"\"& objFile.Name objShell.Run objFile.Name, 1, true end if Next 'Wscript.Echo ShowSubFolders Subfolder Next End Sub '#####End##### Sorry, this is a VB Script, just save it as a .vbs file and it will run on any windows based PC. Cheers Kev.
kevvo2000 Posted April 2, 2013 Posted April 2, 2013 Ah! Just googled the run command and see you set the option to wait till finished, brilliant, thanks, job sorted for me anyway :-) No Problem, Thanks Kev.
jklight Posted April 2, 2013 Posted April 2, 2013 run at command prompt. for /f %a in ('dir /s /b C:\AMB\*.exe') do %a if you run this from a .BAT file, you will need two % for the variables for /f %%a in ('dir /s /b C:\AMB\*.exe') do %%a 1
asifm Posted April 3, 2013 Author Posted April 3, 2013 Hi, for /f %%a in ('dir /s /b C:\AMB\*.exe') do %%a Can you please let me know how should we can set directory path for above script.
asifm Posted April 4, 2013 Author Posted April 4, 2013 run at command prompt. for /f %a in ('dir /s /b C:\AMB\*.exe') do %a if you run this from a .BAT file, you will need two % for the variables for /f %%a in ('dir /s /b C:\AMB\*.exe') do %%a Hi jklight, The above code is perfect for me, but only thing is the executable asks for directory path where this should be installed eg: d:\Setup\xyz How can i set the path for this each .exe, all exe will go at same path.
jklight Posted April 4, 2013 Posted April 4, 2013 From your earlier post as an example, something like this: [color=#333333]@[/color][u][url="http://www.edugeek.net/members/echo.html"]echo[/url][/u][color=#333333] off[/color] [color=#333333]set /P _license file=License file path:[/color] [color=#333333]set /P _directory=New Test Install Directory:[/color] for /f %a in ('dir /s /b [color=#333333]C:\Plugins\*.[/color]exe') do [color=#333333]%a [/color][color=#333333]/qs C:\Test70.log /L "%_license file%" /d "%_directory%"[/color] [color=#333333] IISRESET [/color]
asifm Posted April 5, 2013 Author Posted April 5, 2013 From your earlier post as an example, something like this: [color=#333333]@[/color][u][url="http://www.edugeek.net/members/echo.html"]echo[/url][/u][color=#333333] off[/color] [color=#333333]set /P _license file=License file path:[/color] [color=#333333]set /P _directory=New Test Install Directory:[/color] for /f %a in ('dir /s /b [color=#333333]C:\Plugins\*.[/color]exe') do [color=#333333]%a [/color][color=#333333]/qs C:\Test70.log /L "%_license file%" /d "%_directory%"[/color] [color=#333333] IISRESET [/color] After that code i am getting this error: Unable to determine the base application for the plugin in C:\ Please contact Yardi Systems Customer Service. Click OK to Exit. can you please help me out?
asifm Posted April 8, 2013 Author Posted April 8, 2013 Can someone let me know what does this below script does? I am unable understand %temp%\abc.bat. dir /s /b C:\AMB| find "abc.exe" > %temp%\abc.bat call %temp%\abc.bat
asifm Posted April 12, 2013 Author Posted April 12, 2013 Can someone let me know what does this below script does? I am unable understand %temp%\abc.bat. dir /s /b C:\AMB| find "abc.exe" > %temp%\abc.bat call %temp%\abc.bat Hi, The script is finding the exe and running also but not installating while it throws an error , unable to determine the setup version. when we run plugin.exe manully it also asks for the directory path where its base version setup is installed, we need to enter that path over thier and then click next to continue the setup, but while running script it is not inheriting the path which we set as directory /d "%_directory%" Can you please help me to correct this, or any other way where i can achieve this goal?
asifm Posted April 15, 2013 Author Posted April 15, 2013 From your earlier post as an example, something like this: [color=#333333]@[/color][u][url="http://www.edugeek.net/members/echo.html"]echo[/url][/u][color=#333333] off[/color] [color=#333333]set /P _license file=License file path:[/color] [color=#333333]set /P _directory=New Test Install Directory:[/color] for /f %a in ('dir /s /b [color=#333333]C:\Plugins\*.[/color]exe') do [color=#333333]%a [/color][color=#333333]/qs C:\Test70.log /L "%_license file%" /d "%_directory%"[/color] [color=#333333] IISRESET [/color] Can i get powershell script, similar to this script? Please help!
JJanisch Posted May 15, 2013 Posted May 15, 2013 Why dont you use the VBS script written above? Paste it into notepad and save it as .vbs, then just run that file as if it was a batch. No difference, just VBS is a better language! * And has already been written for you
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now