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

  • Home
  • SEARCH
  • 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 8820631
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T05:39:21+00:00 2026-06-14T05:39:21+00:00

a little problem keeps bugging me for couple of days. I’m trying to extract

  • 0

a little problem keeps bugging me for couple of days. I’m trying to extract a string I can define with regexp from a *.exe binary, text like “1.01.01.00T123” into a environment variable for further use.
I’ve found the string with

findstr /i [0-9]\.[0-9][0-9]\.[0-9][0-9]\.[0-9][0-9][T][0-9][0-9][0-9] name.exe>outp.bin

now it’s my string in a little bit smaller binary, maybe 200bytes. Then I was trying to use an output of findstr in a “for /f”, but what delimiter should I use for the binary, nothing is guaranteed. Even dots and blanks can come and go.
Something like:

for /f "tokens=1,2,3,4* delims=^." %%a in ('findstr /i [0-9]\.[0-9][0-9]\.[0-9][0-9]\.[0-9][0-9]T[0-9][0-9][0-9] name.exe') do (
echo %%a
echo %%b
echo %%c
echo %%d
)

It works only halfway – the first is too long, an the last part “xxTxxx” isn’t a token by this definition. Besides a dot can also happen inside of a binary, and not only in my string.
I thought of something like shorten the outp.bin in loop by cutting always the first byte and then check if my string is at the start of the outp.bin. But still haven’t found way to do this. Is it possible?
Is there any way, that’s less complex to just copy my regex result into a variable?
I hope missed some magic command for the regexp in a standard command shell.

  • 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-14T05:39:22+00:00Added an answer on June 14, 2026 at 5:39 am

    It is nearly impossible to do what you want with pure batch because your binary may include nul bytes and batch cannot process null bytes. But the problem can easily be solved using VBS or JScript and regular expressions.

    Here is a very crude VBS solution, with lots of room for improvement. But it works.

    findStr.vbs

    Set myRegExp = New RegExp
    myRegExp.IgnoreCase = True
    myRegExp.Global = True
    myRegExp.Pattern = "\d\.\d\d\.\d\d\.\d\dT\d\d\d"
    Set matches = myRegExp.Execute(WScript.StdIn.ReadAll())
    For Each match In matches
      WScript.StdOut.WriteLine(match.value)
    Next
    

    Call the script with CSCRIPT and redirect input to your exe file.

    <name.exe cscript //nologo findStr.vbs
    

    You could use batch to process the results via FOR /F.

    for /f "delims=" %%A in ('^<name.exe cscript //nologo findStr.vbs') do echo %%A
    

    UPDATE – 2015-08-26

    You could easily solve this with JREPL.BAT – a pure script based regex processing utlity (hybrid JScript/batch) that runs natively on any Windows machine from XP onward. Full documentation is embedded within the script.

    The following simply lists the value(s) found in the file. Note that the /M option is required because of possible null bytes in the exe.

    call jrepl "\d\.\d\d\.\d\d\.\d\dT\d\d\d" $0 /jmatch /m /f name.exe
    

    To capture the value in a variable (or the last value if there are multiple occurrences):

    for %%A in (
      'jrepl "\d\.\d\d\.\d\d\.\d\dT\d\d\d" $0 /jmatch /m /f name.exe'
    ) do set "str=%%A"
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i got a little problem with downloading images from the web to my android
I have a little problem about the sort direction of a specific column in
I have a little problem with Jquery getJSON function. my json here { entries:
I am having a little problem with Relative Layouts. I'm doing a project in
I'm having a little problem with the auto-resizing feature! I've already proficiently triple-checked (with
I have a little Problem with the app that I'm developing. In the App
I have a little problem. This is my code: stackPanelShapesContainer = new StackPanel(); InitializeStackPanle();
i have a little problem with my java socket code. I'm writing an android
so i have a little problem with placing a hover tooltip with jquery -
Today i have a little problem containing a File Upload. First some Infos: Rubyversion:

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.