Debugging quick program

Dell / Latitude d830
October 14, 2009 at 16:50:39
Specs: Microsoft Windows XP Professional, 1.795 GHz / 2038 MB
Here's the code:

@echo off
setlocal enabledelayedexpansion
set skip=f
for /f %%a in (key.txt) do (
for %%b in ("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") do (
if "!skip!"=="f" (
if "!%%~b!"=="" set %%~b=%%a && set skip=t
set skip=f
set/p test=Text to Encode:
for %%a in ("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") do (
set test=!test:%%~a=!%%~a!!
echo %test%

key.txt is a text file that has 1-26, on 26 lines
(1st line=1 2nd line=2 etc.)
This program assigns the number an the first line to variable a then the next line to b, etc. This portion works fine. But when I try to replace letters that you type in with numbers, instead of replacing it the out put is the letters a-z. No clue why...

I would appreciate some help. Thanks.

There are no stupid questions, just stupid people.

See More: Debugging quick program

Report •

October 14, 2009 at 19:34:03
set test=!test:%%~a=!%%~a!!
I'm not sure what this produces, but chances are it isn't what you intended.

(It's parsed as [set test=] [!test:%%~a=!] [%%~a] [!!])

Report •
Related Solutions

Ask Question