Search code examples
batch-fileencryptionletters

Batch file to allow encrypt and decrypt capital letters for this code


i want this code to be able to encrypt the capital letters because when i add capital letters it will be encrypted like the small letters

this is the code

encryption code

http://pastebin.com/Xy2gCmtQ

decryption code

http://pastebin.com/rZtrwaJD


Solution

  • You have to make a loop with an IF test to check if the char is lower or upper case :

    Example :

    @echo off
    
    ::The string to Encrypt
    
    set "$string=aBA baB"
    
    setlocal enabledelayedexpansion
    
    for /l %%i in (0,1,9000) do (
       set char=!$string:~%%i,1!
          if "!char!"==" " set char=#
          if defined char (
    
    REM here the tests and substitutions
             if !char!==a set "char=!char:a=[aSmall]!"
             if !char!==A set "char=!char:A=[ACapital]!"
             if !char!==b set "char=!char:b=[bSmall]!"
             if !char!==B set "char=!char:B=[BCapital]!"
    
             set "$final=!$final!!char!"
            )
    )
    echo %$String% --^> !$final:#= !