Knightmare Posted October 31, 2012 Share Posted October 31, 2012 So far, I'm doing okay with this project. I would, however, like to move the batch file outside of the folder so that it does not get mixed in with the installer files. Can anyone tell me how to add the folder location of the installers to my code? The name of the folder is "Freeware Installers." Here is what the file looks like now:@Echo offstart /wait AdobeAIRInstaller.exe -silentstart /wait install_flash_player_11_active_x.exe -installstart /wait install_flash_player_11_plugin.exe -installstart /wait jre-7u9-windows-i586.exe /sstart /wait jre-7u9-windows-x64.exe /sstart /wait QT_Lite_410.exe /VERYSILENTstart /wait 7z920-x64.msistart /wait ccsetup324.exestart /wait cfosspeed-v802.exestart /wait fdminst.exestart /wait getdiz46.exestart /wait rcsetup143.exestart /wait RocketDock-v1.3.5.exestart /wait SkypeSetupFull.exestart /wait Unlocker1.9.1-x64start /wait uTorrent.exestart /wait vlc-2.0.4-win32.exeAll of the files are in the same folder, as I mentioned, so where do I add the folder location in the code? Link to comment Share on other sites More sharing options...
c0vert Posted October 31, 2012 Share Posted October 31, 2012 All of the files are in the same folder, as I mentioned, so where do I add the folder location in the code?Just add this code:cd "locationoffile"For example:@echo ONcd "C:\Program Files\LastPass"start lastpass.exepauseorUse this code:set PATH=locationoffileFor example:@echo ONset PATH=C:\Program Files\LastPassstart lastpass.exepauseHere's a website for batch commands and functions:http://academic.evergreen.edu/projects/biophysics/technotes/program/batch.htm Link to comment Share on other sites More sharing options...
Knightmare Posted October 31, 2012 Author Share Posted October 31, 2012 Is that for the location of the installers or is this telling them where to install? I want to tell the batch file where the installer files are located when I take it outside the folder. Link to comment Share on other sites More sharing options...
c0vert Posted October 31, 2012 Share Posted October 31, 2012 Is that for the location of the installers or is this telling them where to install? I want to tell the batch file where the installer files are located when I take it outside the folder.It points to the location of the installation files.For example, I have a folder in C:\Projects with installation exes:@echo ON ;displays commands in command promptset PATH=C:\Projects ;sets current path to C:\Projectsstart lastpass.exe ;executes lastpass installation exestart vlc-2.0.4-win32.exe ;executes VLC installation exepause ;pauses command prompt so that you can view the commands executed Link to comment Share on other sites More sharing options...
c0vert Posted October 31, 2012 Share Posted October 31, 2012 Just found something cool that might help you. In case you don't want 20 different installations popping up all at once, here are some useable sample codes to create a 5 second delay between loading each exe and/or to create a pause between installations (look below for a detailed breakdown on what's going on):5 Second Delay:@echo OFFset /A x=17:RESETPATHset path=C:\Projectsgoto %x%:17start /wait AdobeAIRInstaller.exe -silentgoto DELAY:16start /wait install_flash_player_11_active_x.exe -installgoto DELAY:15start /wait install_flash_player_11_plugin.exe -installgoto DELAY:14start.....goto DELAYetc...:DELAYset PATH=%SystemRoot%\system32;%SystemRoot%ping 1.1.1.1 -n 1 -w 6000 >NULset /A x = %x% - 1if (%x)==(0) goto ENDgoto RESETPATH:ENDexitUser must press "any key to continue..." in the command prompt to continue to the next installation:@echo OFFset /A x=17:RESETPATHset path=C:\Projectsgoto %x%:17start /wait AdobeAIRInstaller.exe -silentgoto DELAY:16start /wait install_flash_player_11_active_x.exe -installgoto DELAY:15start /wait install_flash_player_11_plugin.exe -installgoto DELAY:14start.....goto DELAYetc...:DELAYpauseset /A x = %x% - 1if (%x)==(0) goto ENDgoto RESETPATH:ENDexitNotes on what's going on:@echo OFF <--- turn this on to view the code being executed in the command line boxset /A x=17 <--- /A denotes an arithmetic operand; sets x to 17 (or how many exe installations you have in the folder), this number acts like a label countdown:RESETPATH<--- this is the start to the "looping," it will RESET the command line folder path to C:\Projects to reduce redundant codeset PATH=C:\Projects<--- sets the command line folder path to C:\Projectsgoto %x% <--- jumps to the next lower label; x will be subtracted by 1 each time it passes through the DELAY label; but the first time it is executed here, it'll be: 17, so it goes to label 17, then once it passes through DELAY, it'll go to label 16, then once it passes through DELAY again, it'll go to label 15, and so on...:17 <--- this is a labelstart /wait AdobeAIRInstaller.exe -silent <--- executes the installation filegoto DELAY <--- jumps to the label DELAY:16 <--- this is our next label to install the next filestart /wait install_flash_player_11_active_x.exe -install <--- executes the installation filegoto DELAY <--- jumps to the label DELAY:15 <--- this is our next label to install the next filestart /wait install_flash_player_11_plugin.exe -install <--- executes the installation filegoto DELAY <--- jumps to the label DELAY:DELAY <--- this label acts as our countdown and 5 second delayset PATH=%SystemRoot%\system32;%SystemRoot% <--- replaces the command line folder path to root system32 (you need to change the folder path to system root, else when ping is executed it'll try to ping from C:\Projects and it'll error)ping 1.1.1.1 -n 1 -w 6000 >NUL <---this creates a 5 second delay by pinging an invalid IP; -n= number of attempts to ping, -w=number of milliseconds between attempts, and >NUL means when it fails to ping, it will skip to the next piece of code below(pause) <---this pauses the code until the user "press[es] any key to continue..."; this replaces the two pieces of code aboveset /A x = %x% - 1 <--- /A denotes an arithmetic operand; this acts like a countdown by taking variable x (=17), subtracts it by 1, then stores it back into x. This will continue to subtract until it hits 0; the first time this is run, it'll go 17-1=16, store 16 in to variable x, then once label 16 is executed, it will come back to this instruction and go 16-1=15, store 15 into variable x, and so on.if (%x)==(0) goto END <--- this compares if variable x=0, if it's 0, then it jumps to the END label goto RESETPATH<--- if x is larger than 0, it jumps back to label RESETPATH, so it can reset the path back C\:Project before going to the next x label (16, 15, 14, etc.):END <--- label to end the codeexit <--- exits the command promptNotes:If you want to use the code above, replace "set p=C:\Projects" with your folder destination and continue to input the labels (17-1) with each unique installation exe. The procedure is simple: Create the label :14, then underneath that type in start /wait followed by installation exe name, underneath that type in goto DELAY underneath that type in :13, then below that type in start /wait followed by installation exe name, underneath that type in goto DELAY...and so on.You can replace "ping 1.1.1.1 -n 1 -w 6000 >NUL" with "sleep 5", if you're running Microsoft Windows NT Workstation Resource Kit. Link to comment Share on other sites More sharing options...
c0vert Posted October 31, 2012 Share Posted October 31, 2012 Is that for the location of the installers or is this telling them where to install? I want to tell the batch file where the installer files are located when I take it outside the folder. If the code I created in the above post is too complex to understand, I think I might know of easier way, which involves executing any installation file, then deleting it, then executing the next installation file, then deleting it...and so on. All of this will be automated, except you'll have to press a key in the command line box each time the installation has completed. This way you won't need to specify labels, nor specify which .exe to start, nor specify how many exe's are in the folder. It'll basically loop itself and install each exe until the folder is empty. Let me know if you're interested and I'll write it out. Link to comment Share on other sites More sharing options...
Knightmare Posted October 31, 2012 Author Share Posted October 31, 2012 Is that for the location of the installers or is this telling them where to install? I want to tell the batch file where the installer files are located when I take it outside the folder.If the code I created in the above post is too complex to understand, I think I might know of easier way, which involves executing any installation file, then deleting it, then executing the next installation file, then deleting it...and so on. All of this will be automated, except you'll have to press a key in the command line box each time the installation has completed. This way you won't need to specify labels, nor specify which .exe to start, nor specify how many exe's are in the folder. It'll basically loop itself and install each exe until the folder is empty. Let me know if you're interested and I'll write it out.What you wrote above isn't complex, I just don't think I'm stating what I want correctly. I found the fix to this, but ignored it for some reason and now I can't find the site again, hence why I posted my request here. ;)Here's what I thought it should say if the files are in the folder called "Freeware Installers":@Echo offstart /wait Freeware Installers\AdobeAIRInstaller.exe -silentstart /wait Freeware Installers\install_flash_player_11_active_x.exe -installstart /wait Freeware Installers\install_flash_player_11_plugin.exe -installetc...etc...But when I put this file outside of the folder on the flash drive and run this, I get an error. It says something like "Cannot find 'Freeware'" but I didn't put "Freeware," I put "Freeware Installers." Why doesn't it include the "Installers" in the name? Link to comment Share on other sites More sharing options...
c0vert Posted October 31, 2012 Share Posted October 31, 2012 Is that for the location of the installers or is this telling them where to install? I want to tell the batch file where the installer files are located when I take it outside the folder.If the code I created in the above post is too complex to understand, I think I might know of easier way, which involves executing any installation file, then deleting it, then executing the next installation file, then deleting it...and so on. All of this will be automated, except you'll have to press a key in the command line box each time the installation has completed. This way you won't need to specify labels, nor specify which .exe to start, nor specify how many exe's are in the folder. It'll basically loop itself and install each exe until the folder is empty. Let me know if you're interested and I'll write it out.What you wrote above isn't complex, I just don't think I'm stating what I want correctly. I found the fix to this, but ignored it for some reason and now I can't find the site again, hence why I posted my request here. ;)Here's what I thought it should say if the files are in the folder called "Freeware Installers":@Echo offstart /wait Freeware Installers\AdobeAIRInstaller.exe -silentstart /wait Freeware Installers\install_flash_player_11_active_x.exe -installstart /wait Freeware Installers\install_flash_player_11_plugin.exe -installetc...etc...But when I put this file outside of the folder on the flash drive and run this, I get an error. It says something like "Cannot find 'Freeware'" but I didn't put "Freeware," I put "Freeware Installers." Why doesn't it include the "Installers" in the name?It's because of the space between the words. To keep it simple, just delete the space in "Freeware Installers" and rename the folder to "Freeware_Installers."Just note that you're loading 17 different installations .exes all at once. If your computer is old, slow, and has low memory, then it may severely limit the functionality of the computer. This is why I highly recommend at least a delayed start or at best pauses between installs.... unless you're absolutely in need of 17 installs going on all at once. :lol: Link to comment Share on other sites More sharing options...
Knightmare Posted October 31, 2012 Author Share Posted October 31, 2012 Gotcha. So I'll just name the folder "Freeware" then. I don't have to know that they are installers. Thank you! Link to comment Share on other sites More sharing options...
circaal Posted November 1, 2012 Share Posted November 1, 2012 Hey Knightmare,I tried the same thing you did and I got it working, although it did take awhile haha. Anyways to use a two word folder path you need " "If I remember correctly it would be something like thisstart /wait "Freeware Installers\AdobeAIRInstaller.exe" -silentThat should fix the issue of the folder names with one word. Although what you were talking about with the flash drive. I never found a good solution to have the .bat file reach into the flash drive. I don't know if there is some way to assign a drive letter to a flash drive permanently. Like if you could ways have the flash drive be for example drive V:\ then you can hard code it into the .bat file. That would work so your code would look like thiscd "V:\Freeware Installers"start /wait AdobeAIRInstaller.exe -silentorstart /wait "V:\Freeware Installers\AdobeAIRInstaller.exe" -silentThat should work, but like I said I don't know if you can permanently assign a drive letter or if you can do a search for Freeware Installers in the .bat file but that can take a whileLet me know if this helps!-BTY Link to comment Share on other sites More sharing options...
Knightmare Posted November 1, 2012 Author Share Posted November 1, 2012 Hey Knightmare,I tried the same thing you did and I got it working, although it did take awhile haha. Anyways to use a two word folder path you need " "If I remember correctly it would be something like thisstart /wait "Freeware Installers\AdobeAIRInstaller.exe" -silentThat should fix the issue of the folder names with one word. Although what you were talking about with the flash drive. I never found a good solution to have the .bat file reach into the flash drive. I don't know if there is some way to assign a drive letter to a flash drive permanently. Like if you could ways have the flash drive be for example drive V:\ then you can hard code it into the .bat file. That would work so your code would look like thiscd "V:\Freeware Installers"start /wait AdobeAIRInstaller.exe -silentorstart /wait "V:\Freeware Installers\AdobeAIRInstaller.exe" -silentThat should work, but like I said I don't know if you can permanently assign a drive letter or if you can do a search for Freeware Installers in the .bat file but that can take a whileLet me know if this helps!-BTYI think when I tried this I got an error message. I just renamed the folder so that no spaces were in the name and it works fine now. Link to comment Share on other sites More sharing options...
user@nsaneforums Posted November 1, 2012 Share Posted November 1, 2012 better to use dos paths8char 123456~8 Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.