Close Menu
Computing.net
    Facebook X (Twitter) Instagram
    Computing.netComputing.net
    • News
      1. AI
      2. Crypto
      3. Gaming
      4. Hardware
      5. Security
      6. Software
      7. View All

      Anthropic’s COBOL Automation Tool Triggers IBM Stock Plunge and Crypto Market Decline

      February 24, 2026

      AI Trading Bot Loses $441K in Crypto After Decimal Point Mistake

      February 23, 2026

      Tesla (TSLA) Stock: Goodbye Sedans, Hello Robots in Dramatic Production Shift

      January 29, 2026

      Palantir Technologies (PLTR) Stock: Why Bears May Be Wrong About Valuation Concerns

      January 29, 2026

      SUI Token Rallies 40% Following Major Staking Event and CME Futures Announcement

      May 12, 2026

      Chainlink (LINK) Surges to $10.40 as Network Activity Hits Eight-Month Peak

      May 12, 2026

      Dogecoin Whales Ramp Up Accumulation as DOGE Eyes Critical Breakout Levels

      May 12, 2026

      Bitcoin Holds $81K While Burry Flags Nasdaq Bubble and Oil Surges Past $105

      May 12, 2026

      Hamster Kombat: Unraveling TON’s Gaming Phenomenon

      August 7, 2024

      W-Coin: Exploring the Latest Telegram Tap-to-Earn Phenomenon

      August 7, 2024

      Hamster Kombat: 300 Million Players & Counting, HMSTR Token Airdrop Soon!

      July 31, 2024

      Hamster Kombat Developers Work with TON Team on Airdrop Solution

      July 30, 2024

      Nothing Expands Product Line with New AI Feature & Phone Update

      July 31, 2024

      Security Audit Reveals Concerns in Atari’s Blockchain Game on Base

      August 6, 2024

      SideWinder Group Targets Maritime Facilities in New Cyber Espionage Campaign

      July 30, 2024

      OAuth Implementation Flaw Exposes Millions of Websites to XSS Attacks

      July 30, 2024

      Hamster Kombat Players Face Growing Cybersecurity Threats

      July 25, 2024

      Anthropic’s COBOL Automation Tool Triggers IBM Stock Plunge and Crypto Market Decline

      February 24, 2026

      Cookie Crumble: Google Halts Plans to Eliminate Third-Party Cookies in Chrome

      July 23, 2024

      Big Brother is Watching: Apple’s Creepy New Ad Urges iPhone Users to Ditch Chrome

      July 23, 2024

      Nvidia Stock Soars to New Record at $219.44 Ahead of May 20 Earnings

      May 12, 2026

      Rocket Lab Shares Surge Past $120 Following Wave of Analyst Upgrades

      May 12, 2026

      GM Shares Decline Following 600 IT Layoffs Amid Strategic AI Workforce Transformation

      May 12, 2026

      SES Delivers €847M Q1 Performance as Intelsat Integration and Aviation Deals Fuel Expansion

      May 12, 2026
    • How To

      Batch Files: Tokens and Delimiters (FOR Loops)

      July 31, 2024

      Types of Ethernet Cabling & Electrical Low Voltage Wiring

      July 9, 2024

      What You Should Know About .JSON File Extension

      January 10, 2023

      Bkup File Extension

      November 19, 2022

      HEIC File Extension

      November 19, 2022
    • Office
      1. Excel
      2. Google Sheets
      3. View All

      How to Convert Column List to Comma Separated List in Excel

      July 24, 2024

      How to Find the Last Monday of the Month in Excel

      July 24, 2024

      Convert Bytes to MB or GB in Excel: 3 Methods!

      July 24, 2024

      How to Remove Characters from Right in Excel

      July 30, 2023

      How to Subtract in Google Sheets: Complete Guide

      July 31, 2024

      Bullet Points in Google Sheets

      January 20, 2022

      Sort by Date in Google Sheets

      January 18, 2022

      Google Sheets Timestamp

      January 17, 2022

      How to Subtract in Google Sheets: Complete Guide

      July 31, 2024

      How to Convert Column List to Comma Separated List in Excel

      July 24, 2024

      How to Find the Last Monday of the Month in Excel

      July 24, 2024

      Convert Bytes to MB or GB in Excel: 3 Methods!

      July 24, 2024
    • Answers
    • About
    • Contact
    Facebook X (Twitter)
    Computing.net
    How To

    Batch – “string” to hex values

    Computing StaffBy Computing StaffSeptember 23, 2021
    Twitter LinkedIn Email Telegram
    Batch - "string" to hex values
    Twitter LinkedIn Email Telegram

    ::——————————————————-
    ::please use quotes (“”) around the input
    ::——————————————————-
    ::running from cmd:
    ::hex “Hello World!”
    ::——————————————————-
    ::running from the .bat file:
    ::input=”Hello World!”
    ::——————————————————-
    ::output-string=48 65 6C 6C 6F 20 57 6F 72 6C 64
    ::——————————————————-
    ::I was unable to escape ^, so please dont use it 🙂
    ::——————————————————-
    ::set fulloutput to 0 if you only want the input & output
    ::——————————————————-
    set fullouput=0
    setlocal EnableDelayedExpansion
    set string=%1
    ::removes double “” at the end of %string%
    set string=%string:~0,-1%
    ::removes the double “” at the start of %string%
    set string=%string:~1,31%
    call :strlen iamount String
    set line=—
    set ln=———–
    set lncount=0
    :llloop
    set ln=%ln%%line%
    if ‘%linecount%’==’%iamount%’ goto nexxt
    set /a linecount=%linecount%+1
    goto llloop
    :strlen
    (
    setlocal
    set “s=!%~2!#”
    set “len=0”
    for %%P in (4096 2048 1024 512 256 128 64 32 16 8 4 2 1) do (
    if “!s:~%%P,1!” NEQ “” (
    set /a “len+=%%P”
    set “s=!s:~%%P!”
    )))
    (
    endlocal
    set “%~1=%len%”
    exit /b
    )
    :nexxt
    echo %ln%-
    echo Input=        %string%
    if ‘%fullouput%’==’1’ echo Chars=        %iamount%
    if ‘%fullouput%’==’1’ echo %ln%
    :cont
    set i=0
    set j=1
    :loop1
    set char%j%=!!string:~%i%,1!!
    if ‘%fullouput%’==’1’ echo Char%j%=        !char%j%!
    if ‘%j%’==’%iamount%’ goto endloop1
    set /a i=%i%+1
    set /a j=%j%+1
    goto loop1
    :endloop1
    if ‘%fullouput%’==’1’ echo %ln%-
    ::set counter
    set n=1
    :hex
    if ‘!char%n%!’==’^ ‘ set chardec%n%=32
    if ‘!char%n%!’==’^!’ set chardec%n%=33
    if ‘!char%n%!’==’^”‘ set chardec%n%=34
    if ‘!char%n%!’==’^#’ set chardec%n%=35
    if ‘!char%n%!’==’^$’ set chardec%n%=36
    if ‘!char%n%!’==’%%’ set chardec%n%=37
    if ‘!char%n%!’==’^&’ set chardec%n%=38
    if ‘!char%n%!’==’^” set chardec%n%=39
    if ‘!char%n%!’==’^(‘ set chardec%n%=40
    if ‘!char%n%!’==’^)’ set chardec%n%=41
    if ‘!char%n%!’==’^*’ set chardec%n%=42
    if ‘!char%n%!’==’^+’ set chardec%n%=43
    if ‘!char%n%!’==’^,’ set chardec%n%=44
    if ‘!char%n%!’==’^-‘ set chardec%n%=45
    if ‘!char%n%!’==’^.’ set chardec%n%=46
    if ‘!char%n%!’==’^/’ set chardec%n%=47
    if ‘!char%n%!’==’0’ set chardec%n%=48
    if ‘!char%n%!’==’1’ set chardec%n%=49
    if ‘!char%n%!’==’2’ set chardec%n%=50
    if ‘!char%n%!’==’3’ set chardec%n%=51
    if ‘!char%n%!’==’4’ set chardec%n%=52
    if ‘!char%n%!’==’5’ set chardec%n%=53
    if ‘!char%n%!’==’6’ set chardec%n%=54
    if ‘!char%n%!’==’7’ set chardec%n%=55
    if ‘!char%n%!’==’8’ set chardec%n%=56
    if ‘!char%n%!’==’9’ set chardec%n%=57
    if ‘!char%n%!’==’^:’ set chardec%n%=58
    if ‘!char%n%!’==’^;’ set chardec%n%=59
    if ‘!char%n%!’==’^<‘ set chardec%n%=60
    if ‘!char%n%!’==’^=’ set chardec%n%=61
    if ‘!char%n%!’==’^>’ set chardec%n%=62
    if ‘!char%n%!’==’^?’ set chardec%n%=63
    if ‘!char%n%!’==’^@’ set chardec%n%=64
    if ‘!char%n%!’==’A’ set chardec%n%=65
    if ‘!char%n%!’==’B’ set chardec%n%=66
    if ‘!char%n%!’==’C’ set chardec%n%=67
    if ‘!char%n%!’==’D’ set chardec%n%=68
    if ‘!char%n%!’==’E’ set chardec%n%=69
    if ‘!char%n%!’==’F’ set chardec%n%=70
    if ‘!char%n%!’==’G’ set chardec%n%=71
    if ‘!char%n%!’==’H’ set chardec%n%=72
    if ‘!char%n%!’==’I’ set chardec%n%=73
    if ‘!char%n%!’==’J’ set chardec%n%=74
    if ‘!char%n%!’==’K’ set chardec%n%=75
    if ‘!char%n%!’==’L’ set chardec%n%=76
    if ‘!char%n%!’==’M’ set chardec%n%=77
    if ‘!char%n%!’==’N’ set chardec%n%=78
    if ‘!char%n%!’==’O’ set chardec%n%=79
    if ‘!char%n%!’==’P’ set chardec%n%=80
    if ‘!char%n%!’==’Q’ set chardec%n%=81
    if ‘!char%n%!’==’R’ set chardec%n%=82
    if ‘!char%n%!’==’S’ set chardec%n%=83
    if ‘!char%n%!’==’T’ set chardec%n%=84
    if ‘!char%n%!’==’U’ set chardec%n%=85
    if ‘!char%n%!’==’V’ set chardec%n%=86
    if ‘!char%n%!’==’W’ set chardec%n%=87
    if ‘!char%n%!’==’X’ set chardec%n%=88
    if ‘!char%n%!’==’Y’ set chardec%n%=89
    if ‘!char%n%!’==’Z’ set chardec%n%=90
    if ‘!char%n%!’=='[‘ set chardec%n%=91
    if ‘!char%n%!’==’\’ set chardec%n%=92
    if ‘!char%n%!’==’]’ set chardec%n%=93
    if ‘!char%n%!’==’^^’ set chardec%n%=94
    if ‘!char%n%!’==’^_’ set chardec%n%=95
    if ‘!char%n%!’==’^`’ set chardec%n%=96
    if ‘!char%n%!’==’a’ set chardec%n%=97
    if ‘!char%n%!’==’b’ set chardec%n%=98
    if ‘!char%n%!’==’c’ set chardec%n%=99
    if ‘!char%n%!’==’d’ set chardec%n%=100
    if ‘!char%n%!’==’e’ set chardec%n%=101
    if ‘!char%n%!’==’f’ set chardec%n%=102
    if ‘!char%n%!’==’g’ set chardec%n%=103
    if ‘!char%n%!’==’h’ set chardec%n%=104
    if ‘!char%n%!’==’i’ set chardec%n%=105
    if ‘!char%n%!’==’j’ set chardec%n%=106
    if ‘!char%n%!’==’k’ set chardec%n%=107
    if ‘!char%n%!’==’l’ set chardec%n%=108
    if ‘!char%n%!’==’m’ set chardec%n%=109
    if ‘!char%n%!’==’n’ set chardec%n%=110
    if ‘!char%n%!’==’o’ set chardec%n%=111
    if ‘!char%n%!’==’p’ set chardec%n%=112
    if ‘!char%n%!’==’q’ set chardec%n%=113
    if ‘!char%n%!’==’r’ set chardec%n%=114
    if ‘!char%n%!’==’s’ set chardec%n%=115
    if ‘!char%n%!’==’t’ set chardec%n%=116
    if ‘!char%n%!’==’u’ set chardec%n%=117
    if ‘!char%n%!’==’v’ set chardec%n%=118
    if ‘!char%n%!’==’w’ set chardec%n%=119
    if ‘!char%n%!’==’x’ set chardec%n%=120
    if ‘!char%n%!’==’y’ set chardec%n%=121
    if ‘!char%n%!’==’z’ set chardec%n%=122
    if ‘!char%n%!’==’^{‘ set chardec%n%=123
    if ‘!char%n%!’==’^|’ set chardec%n%=124
    if ‘!char%n%!’==’^}’ set chardec%n%=125
    if ‘!char%n%!’==’^~’ set chardec%n%=126
    if ‘%n%’==’%iamount%’ set n=1&goto final
    set /a n=%n%+1
    goto hex
    :final
    if ‘%fullouput%’==’1’ echo Chardec%n%=    !chardec%n%!
    if ‘%n%’==’%iamount%’ (
    set n=1
    if ‘%fullouput%’==’1’ echo %ln%-
    goto convert
    )
    set /a n=%n%+1
    goto final
    :convert
    set input=!chardec%n%!
    set /a modulo=%input%/16
    set /a leftover=%input%-(%modulo%*16)
    if %modulo% gtr 15 goto skip
    if ‘%leftover%’==’15’ set hex2=F
    if ‘%leftover%’==’14’ set hex2=E
    if ‘%leftover%’==’13’ set hex2=D
    if ‘%leftover%’==’12’ set hex2=C
    if ‘%leftover%’==’11’ set hex2=B
    if ‘%leftover%’==’10’ set hex2=A
    if ‘%leftover%’==’9’ set hex2=9
    if ‘%leftover%’==’8’ set hex2=8
    if ‘%leftover%’==’7’ set hex2=7
    if ‘%leftover%’==’6’ set hex2=6
    if ‘%leftover%’==’5’ set hex2=5
    if ‘%leftover%’==’4’ set hex2=4
    if ‘%leftover%’==’3’ set hex2=3
    if ‘%leftover%’==’2’ set hex2=2
    if ‘%leftover%’==’1’ set hex2=1
    if ‘%leftover%’==’0’ set hex2=0
    set hex1=%modulo%
    set charhex%n%=%hex1%%hex2%
    if ‘%fullouput%’==’1’ echo Charhex%n%=    0x!charhex%n%!
    if ‘%n%’==’%iamount%’ echo %ln%-&set n=1&goto output
    set /a n=%n%+1
    goto convert
    :output
    set “outputstring=!outputstring! !charhex%n%!”
    if ‘!n!’==’!iamount!’ echo Output=           !outputstring!&echo %ln%-&exit /b
    set /a n=!n!+1
    goto output

    Share. Twitter LinkedIn Email Telegram
    Avatar photo
    Computing Staff
    • Website

    Related Posts

    Batch Files: Tokens and Delimiters (FOR Loops)

    July 31, 2024

    Types of Ethernet Cabling & Electrical Low Voltage Wiring

    July 9, 2024

    What You Should Know About .JSON File Extension

    January 10, 2023

    Bkup File Extension

    November 19, 2022

    HEIC File Extension

    November 19, 2022

    Working with Batch variables and For loops

    October 6, 2021
    Add A Comment

    Comments are closed.

    Latest

    Nvidia Stock Soars to New Record at $219.44 Ahead of May 20 Earnings

    May 12, 2026

    Rocket Lab Shares Surge Past $120 Following Wave of Analyst Upgrades

    May 12, 2026

    GM Shares Decline Following 600 IT Layoffs Amid Strategic AI Workforce Transformation

    May 12, 2026

    SES Delivers €847M Q1 Performance as Intelsat Integration and Aviation Deals Fuel Expansion

    May 12, 2026

    Trump Dismisses Iran Peace Proposal — Oil Markets React as Hormuz Remains Restricted

    May 12, 2026
    • Facebook
    • Twitter

    Latest Reviews

    Meta Platforms Shares Tumble 8% Despite Strong Q1 Performance Amid AI Investment Surge

    April 30, 2026

    Flush.com Review: Casino & Sportsbook With 275% Welcome Bonus

    March 7, 2026

    Katsubet Review: Crypto Casino With 300% Welcome Bonus & Free Spins

    March 7, 2026

    7Bit Review: Crypto Casino With 325% Bonus & 250 FS

    March 7, 2026

    Mega Dice Review: Crypto Casino With 200% Bonus & 50 Free Spins, Legit?

    March 7, 2026


    Home / Privacy Policy / Terms & Conditions

    Computing.net © 1996 - 2026 Kooc Media Ltd. All rights reserved. Registered Company No.05695741

    Type above and press Enter to search. Press Esc to cancel.