The command will be build inside an environment variable and is no harder that the other tricks we have done with those.
For this to work we need to execute the Command Prompt using the "/V:ON" as we did in the earlier sections. Remember that the "/C" argument will close the Command Prompt window. If you need it open while testing, you can just change it to "/K" and that will keep it open until you close it yourself.
Code:
cmd.exe /V:ON /C
Code:
set alfa=abcdefghijklmnopqrstuvwxyz
So, how does it work? We can address the first letter in "apfa", ("a") with "0" as if it was an array of characters. The letter "b" would be number "1" and the letter "c" would be "2" etc.
Our command of choice is "powershell" and the numbers we need to write that out with, would be the following.
Code:
15, 14, 22, 4, 17, 18, 7, 4, 11 and 11
Code:
for %n in (15, 14, 22, 4, 17, 18, 7, 4, 11, 11)do
The loop including the updated list of numbers will look like the following.
Code:
for %n in (15, 14, 22, 4, 17, 18, 7, 4, 11, 11, 200)do
Code:
do set XYZ=!XYZ!!alfa:~%n,1!
Code:
if %n==200 call %XYZ:~5%
While working on a command it may be useful to see what command you end up being and you can do that by replacing the "call" with "echo". The command will not execute with the "echo" command but it will let you see if you have the correct numbers.
Code:
if %n==200 echo %XYZ:~5%
Code:
cmd.exe /V:ON /C "set alfa=abcdefghijklmnopqrstuvwxyz&&for %n in (15, 14, 22, 4, 17, 18, 7, 4, 11, 11, 200)do set XYZ=!XYZ!!alfa:~%n,1!&&if %n==200 call %XYZ:~5%"
Code:
C:\Users>cmd.exe /V:ON /C "set alfa=abcdefghijklmnopqrstuvwxyz&&for %n in (15, 14, 22, 4, 17, 18, 7, 4, 11, 11, 200)do set XYZ=!XYZ!!alfa:~%n,1!&&if %n==200 call %XYZ:~5%" C:\Users>set XYZ=!XYZ!!alfa:~15,1! && if 15 == 200 call %XYZ:~5% C:\Users>set XYZ=!XYZ!!alfa:~14,1! && if 14 == 200 call %XYZ:~5% C:\Users>set XYZ=!XYZ!!alfa:~22,1! && if 22 == 200 call %XYZ:~5% C:\Users>set XYZ=!XYZ!!alfa:~4,1! && if 4 == 200 call %XYZ:~5% C:\Users>set XYZ=!XYZ!!alfa:~17,1! && if 17 == 200 call %XYZ:~5% C:\Users>set XYZ=!XYZ!!alfa:~18,1! && if 18 == 200 call %XYZ:~5% C:\Users>set XYZ=!XYZ!!alfa:~7,1! && if 7 == 200 call %XYZ:~5% C:\Users>set XYZ=!XYZ!!alfa:~4,1! && if 4 == 200 call %XYZ:~5% C:\Users>set XYZ=!XYZ!!alfa:~11,1! && if 11 == 200 call %XYZ:~5% C:\Users>set XYZ=!XYZ!!alfa:~11,1! && if 11 == 200 call %XYZ:~5% C:\Users>set XYZ=!XYZ!!alfa:~200,1! && if 200 == 200 call %XYZ:~5% Windows PowerShell Copyright (C) Microsoft Corporation. All rights reserved. Try the new cross-platform PowerShell https://aka.ms/pscore6 PS C:\Users>
Code:
cmd.exe /V:ON /C "echo off&&set alfa=abcdefghijklmnopqrstuvwxyz&&for %n in (15, 14, 22, 4, 17, 18, 7, 4, 11, 11, 200)do set XYZ=!XYZ!!alfa:~%n,1!&&if %n==200 call %XYZ:~5%"