Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8083069
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T17:20:23+00:00 2026-06-05T17:20:23+00:00

At work our end-users are on Windows XP and using Outlook Express. Whenever a

  • 0

At work our end-users are on Windows XP and using Outlook Express. Whenever a user composes an email or replies to one, Outlook Express “reads” a static html file located on c:\, and uses the content as a signature. This works perfectly fine.

Now my coworker gave me a simple text(.txt) file with 100+ lines, each line containing a “motivational quote”.

My objective is to somehow have a random quote extracted from this text file, and inserted into the static html-signature file.

Since I am limited to what XP natively supports and can’t install any additional software such as python, I assume either batch or vbscript would be the proper choice (if not only). I imagine a script which is executed via. the Windows Task Scheduler every 15 minutes or so, which randomly reads a line from the .txt-file, and updates it into the static html-signature file.

Is this possible in any way, or are neither batch nor vbscript capable of doing something like that?

Any help or advice will be GREATLY appreciated 🙂

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T17:20:25+00:00Added an answer on June 5, 2026 at 5:20 pm

    You can create a signature template that has embedded variables that are replaced by delayed expansion. Any exclamation point ! or caret ^ literals must be encoded as variables as well:

    !QUOTE! = The random quote
    !X! = exclamation point literal
    !C! = caret literal (probably not needed)

    Additional variables could be added to the template as needed.

    Here is a trivial HTML template as an example

    <!X!doctype html>
    <html>
      <head>
        <title>Random Quote</title>
      </head>
      <body>
        <p><strong>!QUOTE!</strong></p>
      </body>
    </html>
    

    The following batch file will select a random quote from the quote file and write out the signature file after replacing the variables in the template.

    EDIT – I improved performance and slightly altered the limitations by using FOR /F to read the quote line instead of SET /P.

    @echo off
    setlocal disableDelayedExpansion
    
    ::Define the files
    set quoteFile="quotes.txt"
    set signatureTemplate="template.txt"
    set signatureFile="signature.html"
    
    ::Define constants for ! and ^ substitutions in template
    set "X=!"
    set "C=^"
    
    ::Count the number of quotes
    for /f %%N in ('find /c /v "" ^<%quoteFile%') do set quoteCount=%%N
    
    ::Pick a random number of quotes to skip
    set /a "skip=%random% %% %quoteCount%"
    
    ::Load the selected quote into a variable
    if %skip% gtr 0 (set skip=skip=%skip%) else (set skip=)
    for /f "usebackq %skip% delims=" %%A in (%quoteFile%) do (
      set quote=%%A
      goto :break
    )
    :break
    
    ::Read the signature template and write the signature file
    ::Delayed expansion will automatically replace !quote!, !X! and !C!
    setlocal enableDelayedExpansion
    >%signatureFile% (
      for /f "usebackq delims=" %%A in (%signatureTemplate%) do echo %%A
    )
    

    There are a few limitations to the script as written:

    • Template lines that are blank or begin with ; will be skipped
    • The quotes file must not have any blank lines or lines that start with ;
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Page in question: http://phwsinc.com/our-work/one-rincon-hill.asp In IE6-8, when you click the left-most thumbnail in the
I work on a 32 bit end user application that needs a lot of
I'm using CVS on Windows (with the WinCVS front end), and would like to
Recently in our work, I've started getting some experience with SEO (finally). It's something
I'm writing some PowerShell scripts to work with our source control software (which is
I'm trying to work with how our system spits out its code for a
I'm having a problem at work in that our app which uses WCF for
Our codebase where I work is .NET 2.0. For our new assembly/DLLs/web applications I
Our company does work environment surveys, and these surveys are filled in online. All
Our project is in Jetty server and work completely then this project is deployed

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.