Temporary Advertisements:
Ad
Ad
Ad
Improve simple Batch Script
by darkhorse10123 - Saturday January 18, 2025 at 04:30 AM
#1
Hi everyone,
I’ve been working on a batch script to automate Google searches based on a list of terms from a file (
inputs.txt
). Here’s what it does:
  1. Reads search terms line by line from
    inputs.txt
    .
  2. Opens each search term in an incognito browser tab (Microsoft Edge in this case).
  3. Pauses after every 10 tabs to prevent overloading the browser.
Here’s the current code:

===============================================
===============================================
===============================================
===============================================
===============================================
===============================================
@Echo off
setlocal EnableDelayedExpansion

REM Input file containing search terms
set input_file=inputs.txt

REM Check if the input file exists, and prompt the user to create it if not
if not exist "%input_file%" (
    echo ERROR101: 'inputs.txt' not found. Please create the file, add your search terms, and try again.
    pause
    exit
)

REM Initialize the tab counter
set /a num_tabs=0

REM Count the total number of lines in the input file
for /f %%c in ('find /c /v "" %input_file%') do set total_tabs=%%c

REM Process each line in the input file
for /f %%a in (%input_file%) do (
    REM Open the search query in an incognito browser tab
    start msedge --inprivate "https://www.google.com/search?q=%%a"
   
    REM Increment the tab counter
    set /a num_tabs+=1

    REM Pause after every 10 tabs to prevent overloading the browser
    if !num_tabs! geq 10 (
        echo Pausing to prevent overload. Press any key to continue...
        pause
        set /a num_tabs=0
    )
)

echo All searches completed. Total tabs opened: %total_tabs%.
pause
===============================================
===============================================
===============================================
===============================================
===============================================
===============================================

What I’d Like to Improve:
  1. Error Handling: How can I make the script more robust if
    inputs.txt
    has invalid lines or the browser doesn’t respond?
  2. Flexibility: Can I make the browser configurable (e.g., allow switching to Chrome or Firefox)?
  3. Performance: Are there ways to make it faster without risking browser or system overload?
Other Ideas I’m Curious About:
  • Is there a better way to manage large numbers of searches without overloading the system?
  • Could this be extended with additional functionality, like logging search results or saving the output links?
  • Would it make sense to rewrite this in another language for added flexibility?
I’d love to hear your feedback, ideas for improvements, or suggestions for entirely new approaches to this task!
Thanks in advance for your help! ?
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  ✨Free DATABREACH SEARCHERS ✨ DISCORD TO IP ✨ strikedme 173 8,594 1 hour ago
Last Post: genuinelysorry
  ✨DISCORD 2 IP✨ - BEST OSINT / BREACH LOOKUP stormyhabibi 44 4,160 1 hour ago
Last Post: genuinelysorry
  BOT #1 FREE DISCORD OSINT BOT nxe 122 15,342 1 hour ago
Last Post: genuinelysorry
  ❗️OSINT USEFUL TOOLS | WEBSITES❗️ angelguard 769 36,587 2 hours ago
Last Post: DarkNecessities
  FREE - DeepX | Search Engine for Egyptian Citizens Database | Dark Web 0xHH 33 6,433 3 hours ago
Last Post: damixcv1

Forum Jump:


 Users browsing this forum: