Welcome guest. Before posting on our computer help forum, you must register. Click here it's easy and free.

Author Topic: Someone please explain to me how this code work?  (Read 3121 times)

0 Members and 1 Guest are viewing this topic.

behad-007

  • Guest
Someone please explain to me how this code work?
« on: July 27, 2011, 12:57:43 AM »
Someone please explain to me how this code work?

@echo off
setlocal
%1 %0 :: A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
set A=%5&set B=%6&set C=%8&set D=%3
for %%? in (1 2 3 4 5 6 7 8 9) do shift
set A=%C%%7%A%&set C=%D%%4%B%&set D=%7
for %%? in (1 2 3 4 5 6 7 8 9) do shift
echo %A% %C%%2%2 %8%D%%4!

output > GOD BLESS YOU!

tnx

patio

  • Moderator


  • Genius
  • Maud' Dib
  • Thanked: 1769
    • Yes
  • Experience: Beginner
  • OS: Windows 7
Re: Someone please explain to me how this code work?
« Reply #1 on: July 27, 2011, 05:52:30 PM »
Closed.
" Anyone who goes to a psychiatrist should have his head examined. "

Computer Hope Admin

  • Administrator


  • Prodigy

    Thanked: 248
    • Yes
    • Yes
    • Yes
    • Computer Hope
  • Certifications: List
  • Computer: Specs
  • Experience: Guru
  • OS: Windows 10
Re: Someone please explain to me how this code work?
« Reply #2 on: July 29, 2011, 02:23:09 AM »
Re-opening this question since it was never answered after being interrupted by Bill and moved into spam.

To answer the question, Ahh got to love obfuscated code, probably why I like Perl. ;)

Here is a modification of the code to help explain what it is doing, hope it helps. Just added echo and REM statements to help explain and illustrate what is being done as the batch file is being ran.

Code: [Select]
@echo off
REM Setlocal environmental variables - http://www.computerhope.com/setlocal.htm
setlocal
REM Set A-Z starting with %2 being A
%1 %0 :: A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
echo Alphabet = %2%3%4%5%6%7%8%9
REM set the A,B,C,D variables - http://www.computerhope.com/sethlp.htm
set A=%5&set B=%6&set C=%8&set D=%3
echo 1:A=%a% -- B=%B% -- C=%C% -- D=%D%  (2=%2 4=%4 8=%8)
REM Go through for loop and shift %1-9 - FOR: http://www.computerhope.com/forhlp.htm | SHIFT: http://www.computerhope.com/shift.htm
for %%? in (1 2 3 4 5 6 7 8 9) do shift
echo Alphabet = %2%3%4%5%6%7%8%9
echo 2:A=%a% -- B=%B% -- C=%C% -- D=%D%  (2=%2 4=%4 8=%8)
REM Set the new shifted characters into the A,B,C,D variables again.
set A=%C%%7%A%&set C=%D%%4%B%&set D=%7
echo 3:A=%a% -- B=%B% -- C=%C% -- D=%D%  (2=%2 4=%4 8=%8)
REM Shift again
for %%? in (1 2 3 4 5 6 7 8 9) do shift
echo Alphabet = %2%3%4%5%6%7%8%9
echo 4:A=%a% -- B=%B% -- C=%C% -- D=%D% (2=%2 4=%4 8=%8)
REM Finally, just add the %2%2 for double 's' after BLE (which is what %C% is equal to and the %8 for Y and %4 for U
echo %A% %C%%2%2 %8%D%%4!
Everybody is a genius. But, if you judge a fish by its ability to climb a tree, it will spend its whole life believing that it is stupid.
-Albert Einstein

behad-007

  • Guest
Re: Someone please explain to me how this code work?
« Reply #3 on: July 30, 2011, 04:32:56 AM »
thanks so much for reply
i got that :)
that was very helpful.