Overclock.net › Forums › Software, Programming and Coding › Coding and Programming › Cleaning up my batch script
New Posts  All Forums:Forum Nav:

Cleaning up my batch script

post #1 of 7
Thread Starter 
Hey all,

My batch script looks pretty ugly now, I need help cleaning it up. I'm basically running the same command over and over but with one variable. How can I loop the one command but have it insert a new variable from a list each time until the end of the list? (If that makes sense )
    
CPUMotherboardGraphicsRAM
AMD 64 3500+ Asus A8N SLI Delux 128 MB 1024 MB 
Hard DriveOSMonitorKeyboard
Almost a TB XP Pro Some cheap Flat Panel Wireless Microsoft 
PowerCaseMouseMouse Pad
600 watt embarassing Wireless Microsoft Laser Stooges Baby!! 
  hide details  
Reply
    
CPUMotherboardGraphicsRAM
AMD 64 3500+ Asus A8N SLI Delux 128 MB 1024 MB 
Hard DriveOSMonitorKeyboard
Almost a TB XP Pro Some cheap Flat Panel Wireless Microsoft 
PowerCaseMouseMouse Pad
600 watt embarassing Wireless Microsoft Laser Stooges Baby!! 
  hide details  
Reply
post #2 of 7
Code?
WaterWorks
(13 items)
 
  
CPUMotherboardGraphicsRAM
Core 2 Quad Q6700 (3.79GHz) ASUS Maximus Formula X38 PNY XLR8 GTX280 1024MB 6GB Dual Channel PC6400 5-4-4-12 (800MHz) 
Hard DriveOptical DriveOSMonitor
1.18TB RAID 0 + 500GB RAID 0 + 400GB Spare Lite-On Blu-Ray Drive Windows 7 Ultimate x64 I-INC 28" HDMI 1920x1200 
KeyboardPowerCaseMouse
Logitch G15 Corsair 900w Cooler Master Cosmos 1000 (Modded) Logitch G5 
Mouse Pad
Ergonomic Wrist Support 
  hide details  
Reply
WaterWorks
(13 items)
 
  
CPUMotherboardGraphicsRAM
Core 2 Quad Q6700 (3.79GHz) ASUS Maximus Formula X38 PNY XLR8 GTX280 1024MB 6GB Dual Channel PC6400 5-4-4-12 (800MHz) 
Hard DriveOptical DriveOSMonitor
1.18TB RAID 0 + 500GB RAID 0 + 400GB Spare Lite-On Blu-Ray Drive Windows 7 Ultimate x64 I-INC 28" HDMI 1920x1200 
KeyboardPowerCaseMouse
Logitch G15 Corsair 900w Cooler Master Cosmos 1000 (Modded) Logitch G5 
Mouse Pad
Ergonomic Wrist Support 
  hide details  
Reply
post #3 of 7
Thread Starter 
I had to edit it so I can keep my job

The important stuff is there though

Code:
@ECHO OFF
REM Opens multiple tabs for firefox
SET BROWSER=firefox.exe
SET OPTION=-new-tab
SET WAIT_TIME=10
START %BROWSER% %OPTION% "http://URL.com/Report.asp?ReportID=61&variable=BitTornado-0.3.1-w32install.exe"
@ping 127.0.0.1 -n %WAIT_TIME% -w 1000 > nul
START %BROWSER% %OPTION% "http://URL.com/Report.asp?ReportID=61&variable=BitTorrent-3.4.2.exe"
@ping 127.0.0.1 -n %WAIT_TIME% -w 1000 > nul
START %BROWSER% %OPTION% "http://URL.com/Report.asp?ReportID=61&variable=Gnutella.exe"
@ping 127.0.0.1 -n %WAIT_TIME% -w 1000 > nul
START %BROWSER% %OPTION% "http://URL.com/Report.asp?ReportID=61&variable=Kazaa.exe"
@ping 127.0.0.1 -n %WAIT_TIME% -w 1000 > nul
START %BROWSER% %OPTION% "http://URL.com/Report.asp?ReportID=61&variable=kazaalite.exe"
@ping 127.0.0.1 -n %WAIT_TIME% -w 1000 > nul
START %BROWSER% %OPTION% "http://URL.com/Report.asp?ReportID=61&variable=winmx.exe"
@ping 127.0.0.1 -n %WAIT_TIME% -w 1000 > nul
START %BROWSER% %OPTION% "http://URL.com/Report.asp?ReportID=61&variable=napster.exe"
@ping 127.0.0.1 -n %WAIT_TIME% -w 1000 > nul
START %BROWSER% %OPTION% "http://URL.com/Report.asp?ReportID=61&variable=awhost32.exe"
@ping 127.0.0.1 -n %WAIT_TIME% -w 1000 > nul
START %BROWSER% %OPTION% "http://URL.com/Report.asp?ReportID=61&variable=AWREM32.EXE"
@ping 127.0.0.1 -n %WAIT_TIME% -w 1000 > nul
START %BROWSER% %OPTION% "http://URL.com/Report.asp?ReportID=61&variable=edonkey.exe"
@ping 127.0.0.1 -n %WAIT_TIME% -w 1000 > nul
START %BROWSER% %OPTION% "http://URL.com/Report.asp?ReportID=61&variable=eDonkey2000.exe"
@ping 127.0.0.1 -n %WAIT_TIME% -w 1000 > nul
START %BROWSER% %OPTION% "http://URL.com/Report.asp?ReportID=61&variable=morpheus.exe"
@ping 127.0.0.1 -n %WAIT_TIME% -w 1000 > nul
START %BROWSER% %OPTION% "http://URL.com/Report.asp?ReportID=61&variable=morpheus-gold.exe"
@ping 127.0.0.1 -n %WAIT_TIME% -w 1000 > nul
START %BROWSER% %OPTION% "http://URL.com/Report.asp?ReportID=61&variable=emule.exe"
@ping 127.0.0.1 -n %WAIT_TIME% -w 1000 > nul
START %BROWSER% %OPTION% "http://URL.com/Report.asp?ReportID=61&variable=limewire.exe"
@ping 127.0.0.1 -n %WAIT_TIME% -w 1000 > nul
START %BROWSER% %OPTION% "http://URL.com/Report.asp?ReportID=61&variable=bearshare.exe"
@ping 127.0.0.1 -n %WAIT_TIME% -w 1000 > nul
START %BROWSER% %OPTION% "http://URL.com/Report.asp?ReportID=61&variable=TB2PRO.EXE"
@ping 127.0.0.1 -n %WAIT_TIME% -w 1000 > nul
START %BROWSER% %OPTION% "http://URL.com/Report.asp?ReportID=61&variable=tb2launch.exe"
@ping 127.0.0.1 -n %WAIT_TIME% -w 1000 > nul
START %BROWSER% %OPTION% "http://URL.com/Report.asp?ReportID=61&variable=minitb2.exe"
@ping 127.0.0.1 -n %WAIT_TIME% -w 1000 > nul
START %BROWSER% %OPTION% "http://URL.com/Report.asp?ReportID=61&variable=tb2logon.exe"
@ping 127.0.0.1 -n %WAIT_TIME% -w 1000 > nul
START %BROWSER% %OPTION% "http://URL.com/Report.asp?ReportID=61&variable=tb2init.exe"
@ping 127.0.0.1 -n %WAIT_TIME% -w 1000 > nul
START %BROWSER% %OPTION% "http://URL.com/Report.asp?ReportID=61&variable=YahooMessenger.exe"
@ping 127.0.0.1 -n %WAIT_TIME% -w 1000 > nul
START %BROWSER% %OPTION% "http://URL.com/Report.asp?ReportID=61&variable=aim.exe"
@ping 127.0.0.1 -n %WAIT_TIME% -w 1000 > nul
START %BROWSER% %OPTION% "http://URL.com/Report.asp?ReportID=61&variable=skype.exe"
@ping 127.0.0.1 -n %WAIT_TIME% -w 1000 > nul
START %BROWSER% %OPTION% "http://URL.com/Report.asp?ReportID=61&variable=Trillian.EXE"
@ping 127.0.0.1 -n %WAIT_TIME% -w 1000 > nul
START %BROWSER% %OPTION% "http://URL.com/Report.asp?ReportID=61&variable=Xfire.exe"
@ping 127.0.0.1 -n %WAIT_TIME% -w 1000 > nul
START %BROWSER% %OPTION% "http://URL.com/Report.asp?ReportID=61&variable=Qwired.exe"
@ping 127.0.0.1 -n %WAIT_TIME% -w 1000 > nul
START %BROWSER% %OPTION% "http://URL.com/Report.asp?ReportID=61&variable=pidgin.exe"
@ping 127.0.0.1 -n %WAIT_TIME% -w 1000 > nul
START %BROWSER% %OPTION% "http://URL.com/Report.asp?ReportID=61&variable=logmein.exe"
@ping 127.0.0.1 -n %WAIT_TIME% -w 1000 > nul
START %BROWSER% %OPTION% "http://URL.com/Report.asp?ReportID=61&variable=Ares.exe"
@ping 127.0.0.1 -n %WAIT_TIME% -w 1000 > nul
START %BROWSER% %OPTION% "http://URL.com/Report.asp?ReportID=61&variable=KDX.exe"
@ping 127.0.0.1 -n %WAIT_TIME% -w 1000 > nul
START %BROWSER% %OPTION% "http://URL.com/Report.asp?ReportID=61&variable=Vuze.exe"
@ping 127.0.0.1 -n %WAIT_TIME% -w 1000 > nul
START %BROWSER% %OPTION% "http://URL.com/Report.asp?ReportID=61&variable=uTorrent.exe"
@ping 127.0.0.1 -n %WAIT_TIME% -w 1000 > nul
START %BROWSER% %OPTION% "http://URL.com/Report.asp?ReportID=61&variable=Azureus.exe"
@ping 127.0.0.1 -n %WAIT_TIME% -w 1000 > nul
START %BROWSER% %OPTION% "http://URL.com/Report.asp?ReportID=61&variable=pando.exe"
@ping 127.0.0.1 -n %WAIT_TIME% -w 1000 > nul
    
CPUMotherboardGraphicsRAM
AMD 64 3500+ Asus A8N SLI Delux 128 MB 1024 MB 
Hard DriveOSMonitorKeyboard
Almost a TB XP Pro Some cheap Flat Panel Wireless Microsoft 
PowerCaseMouseMouse Pad
600 watt embarassing Wireless Microsoft Laser Stooges Baby!! 
  hide details  
Reply
    
CPUMotherboardGraphicsRAM
AMD 64 3500+ Asus A8N SLI Delux 128 MB 1024 MB 
Hard DriveOSMonitorKeyboard
Almost a TB XP Pro Some cheap Flat Panel Wireless Microsoft 
PowerCaseMouseMouse Pad
600 watt embarassing Wireless Microsoft Laser Stooges Baby!! 
  hide details  
Reply
post #4 of 7
Just search for batch code for loops ( I don't remember how off hand). And then put your list in a txt file and your batch file can call that txt file and run through it.

Here's a start

http://home.att.net/~gobruen/progs/d...batch.html#for
Edited by stanrc - 12/16/08 at 9:48am
Bravo
(13 items)
 
  
CPUMotherboardGraphicsRAM
X4 955 @ 3.6 Asus M479T 4870 1GB 8 GB DDR3 
Hard DriveOSPowerCase
160 GB Win 7 Antec 750w Antec 300 
  hide details  
Reply
Bravo
(13 items)
 
  
CPUMotherboardGraphicsRAM
X4 955 @ 3.6 Asus M479T 4870 1GB 8 GB DDR3 
Hard DriveOSPowerCase
160 GB Win 7 Antec 750w Antec 300 
  hide details  
Reply
post #5 of 7
Seems like you need a FOR loop. I'm not too familiar with windows scripts so that's as far as I can help you
post #6 of 7
It might be easier to fix the web site.
Underground
(14 items)
 
  
CPUMotherboardGraphicsRAM
Core i7 920 C0 ASUS P6T6 WS Revolution GTX 460 TR3X6G1600C8D 
Hard DriveOptical DriveCoolingOS
WD1001FALS SAMSUNG SH-S223F 22X DVD MULTI Corsair H50 Fedora 16 KDE x86_64 
MonitorKeyboardPowerCase
HP w19b Microsoft Comfort Curve Corsair CX600 Thermaltake Armor VA8003BWS 
MouseMouse Pad
Razer DeathAdder Black 
  hide details  
Reply
Underground
(14 items)
 
  
CPUMotherboardGraphicsRAM
Core i7 920 C0 ASUS P6T6 WS Revolution GTX 460 TR3X6G1600C8D 
Hard DriveOptical DriveCoolingOS
WD1001FALS SAMSUNG SH-S223F 22X DVD MULTI Corsair H50 Fedora 16 KDE x86_64 
MonitorKeyboardPowerCase
HP w19b Microsoft Comfort Curve Corsair CX600 Thermaltake Armor VA8003BWS 
MouseMouse Pad
Razer DeathAdder Black 
  hide details  
Reply
post #7 of 7
Thread Starter 
This did it. I have a separate list of all my variables.

Code:
@ECHO OFF
REM Opens multiple tabs for firefox
SET BROWSER=firefox.exe
SET OPTION=-new-tab
SET WAIT_TIME=10
FOR /F %%v IN (variables.txt) DO (
START %BROWSER% %OPTION% "http://URL.com/Report.asp?ReportID=61&variable=%%v"
ping 127.0.0.1 -n %WAIT_TIME% -w 1000 > nul
)
    
CPUMotherboardGraphicsRAM
AMD 64 3500+ Asus A8N SLI Delux 128 MB 1024 MB 
Hard DriveOSMonitorKeyboard
Almost a TB XP Pro Some cheap Flat Panel Wireless Microsoft 
PowerCaseMouseMouse Pad
600 watt embarassing Wireless Microsoft Laser Stooges Baby!! 
  hide details  
Reply
    
CPUMotherboardGraphicsRAM
AMD 64 3500+ Asus A8N SLI Delux 128 MB 1024 MB 
Hard DriveOSMonitorKeyboard
Almost a TB XP Pro Some cheap Flat Panel Wireless Microsoft 
PowerCaseMouseMouse Pad
600 watt embarassing Wireless Microsoft Laser Stooges Baby!! 
  hide details  
Reply
New Posts  All Forums:Forum Nav:
  Return Home
  Back to Forum: Coding and Programming
Overclock.net › Forums › Software, Programming and Coding › Coding and Programming › Cleaning up my batch script