Trying to create D2C routine

Microsoft Windows xp professional w/serv...
June 4, 2010 at 06:31:40
Specs: Windows XP SP3
I'm trying to create a decimal to character
batch file that can be called, passing to it a
variable name I'd like to set, plus a string of
numbers. My problem comes to ascii 33, the
exclamation point. Here's what I have so far:

:: Decimal to Character Subroutine
@ECHO OFF
SETLOCAL ENABLEDELAYEDEXPANSION

:d2c
SET variable=%1
SET value=
SHIFT
:loop
IF "%1"=="" GOTO END
SET number=%1
:: Skip illegal characters
IF !number! LEQ 31 (
	SHIFT
	GOTO loop
)
IF !number! GEQ 127 (
	SHIFT
	GOTO loop
)
SET number=!number:32= !
SET number=!number:33=^!!
SET number=!number:34="!
SET number=!number:35=#!
SET number=!number:36=$!
SET number=!number:37=%%!
<snip 38-123, you get the gist>
SET number=!number:124=^|!
SET number=!number:125=^}!
SET number=!number:126=^~!
SET value=!value!!number!
SHIFT
GOTO loop

:END
SET !variable!=!value!

@ECHO.!value!
GOTO :EOF

I've tried escaping the ! with ^!!, ^^!!, ^!!!, ^^!!^!, but I've
just not been able to ever set "number=!". How
do I SET a variable to include an exclamation
point? Thanks!


See More: Trying to create D2C routine

Report •


#1
June 4, 2010 at 09:22:51
SET number=%number:33=!%

Report •

#2
June 4, 2010 at 09:31:07
SET number=%number:33=!%

Not if delayed expansion in enabled, the only real way(I can think of) is to not have delayed expansion enabled when the subroutine is called, nor enable it in the subroutine. Please, please, please correct me if I'm wrong.


Btw:

I had some limited success with "set number=!number:33=^!^^!!", but couldn't get it to pan out.....


Report •

#3
June 4, 2010 at 10:36:21
Judago, I think you're right. You can disable delayed expansion
before you set to ! and then reenable it if you really have to.

Report •

Related Solutions

#4
June 4, 2010 at 10:56:40
Yes, I think EnableDelayedExpansion is required to set the
passed variable name's value at the end.

I end up with either of these situations:

E:\Temp\Test Video>call d2c xxx 72 101 108 108 111 32 87 
111 114 108 100 33
H!e!l!l!o! !W!o!r!l!d!!

E:\Temp\Test Video>call d2c xxx 72 101 108 108 111 32 87 
111 114 108 100 33
Hello World34="

Both are close, but just not there...

Here's the entire batch (sans "33" processing including the fixed "33" processing) so you guys don't have to reinvent the wheel:

:: d2c.bat - Decimal to Character Routine
@ECHO OFF
SETLOCAL ENABLEEXTENSIONS ENABLEDELAYEDEXPANSION

:loop
IF "%1"=="" GOTO END
SET number=%1
:: Skip illegal characters
IF !number! LEQ 31 (
	SHIFT
	GOTO loop
)
IF !number! GEQ 127 (
	SHIFT
	GOTO loop
)
SET number=!number:32= !
SETLOCAL DISABLEDELAYEDEXPANSION
SET number=%number:33=!%
ENDLOCAL
SETLOCAL ENABLEDELAYEDEXPANSION
SET number=!number:34="!
SET number=!number:35=#!
SET number=!number:36=$!
SET number=!number:37=%%!
SET number=!number:38=^&!
SET number=!number:39=^'!
SET number=!number:40=^(!
SET number=!number:41=^)!
SET number=!number:42=^*!
SET number=!number:43=^+!
SET number=!number:44=^,!
SET number=!number:45=^-!
SET number=!number:46=^.!
SET number=!number:47=^/!
SET number=!number:48=0!
SET number=!number:49=1!
SET number=!number:50=2!
SET number=!number:51=3!
SET number=!number:52=4!
SET number=!number:53=5!
SET number=!number:54=6!
SET number=!number:55=7!
SET number=!number:56=8!
SET number=!number:57=9!
SET number=!number:58=^:!
SET number=!number:59=^;!
SET number=!number:60=^<!
SET number=!number:61=^=!
SET number=!number:62=^>!
SET number=!number:63=^?!
SET number=!number:64=^@!
SET number=!number:65=A!
SET number=!number:66=B!
SET number=!number:67=C!
SET number=!number:68=D!
SET number=!number:69=E!
SET number=!number:70=F!
SET number=!number:71=G!
SET number=!number:72=H!
SET number=!number:73=I!
SET number=!number:74=J!
SET number=!number:75=K!
SET number=!number:76=L!
SET number=!number:77=M!
SET number=!number:78=N!
SET number=!number:79=O!
SET number=!number:80=P!
SET number=!number:81=Q!
SET number=!number:82=R!
SET number=!number:83=S!
SET number=!number:84=T!
SET number=!number:85=U!
SET number=!number:86=V!
SET number=!number:87=W!
SET number=!number:88=X!
SET number=!number:89=Y!
SET number=!number:90=Z!
SET number=!number:91=^[!
SET number=!number:92=^\!
SET number=!number:93=^]!
SET number=!number:94=^^!
SET number=!number:95=^_!
SET number=!number:96=^`!
SET number=!number:97=a!
SET number=!number:98=b!
SET number=!number:99=c!
SET number=!number:100=d!
SET number=!number:101=e!
SET number=!number:102=f!
SET number=!number:103=g!
SET number=!number:104=h!
SET number=!number:105=i!
SET number=!number:106=j!
SET number=!number:107=k!
SET number=!number:108=l!
SET number=!number:109=m!
SET number=!number:110=n!
SET number=!number:111=o!
SET number=!number:112=p!
SET number=!number:113=q!
SET number=!number:114=r!
SET number=!number:115=s!
SET number=!number:116=t!
SET number=!number:117=u!
SET number=!number:118=v!
SET number=!number:119=w!
SET number=!number:120=x!
SET number=!number:121=y!
SET number=!number:122=z!
SET number=!number:123=^{!
SET number=!number:124=^|!
SET number=!number:125=^}!
SET number=!number:126=^~!
SET value=!value!!number!
SHIFT
GOTO loop

:END
@ECHO.!value!
EXIT /B


Report •

#5
June 4, 2010 at 11:10:28
Ya know, you guys & gals are all right! Disabling Delayed
Expansion before "33" processing and re-enabling it after:

SET number=!number:32= !
SETLOCAL DISABLEDELAYEDEXPANSION
SET number=%number:33=!%
SETLOCAL ENABLEDELAYEDEXPANSION
SET number=!number:34="!

gives the intended result:

E:\Temp\Test Video>call d2c xxx 72 101 108 108 111 
32 87 111 114 108 100 33
Hello World!

This will go a LONG way when working with WMIC in batch,
where things like your connected wireless SSID are stored in
the decimal format of the ascii characters they represent,
basically the sole purpose of creating this routine...


Report •

#6
June 4, 2010 at 11:21:02
Arg! Now I get: "Maximum setlocal recursion level reached."
I need some EndLocals it appears.

Edit: EndLocals applied. See response #4 for working copy...


Report •

#7
June 4, 2010 at 13:18:57
I made a very similar program awhile back that kind of worked
:(adapted here to your application):
@echo off & setlocal
set asc= ^^!"#$%%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~
::asc1 is for display only
set asc1= _"#$%%^&'^(^)*+,-./0123456789:;^<^=^>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{^|}~
echo 0123456789012345678901234567890123456789012345678901234567890123456789012345678
echo "%asc1%"
pause
setlocal enabledelayedexpansion
:get
set xx=%1
if "%xx%" equ "" goto :disp
if '%xx%' equ '' goto :disp
set /a xx-=32
set ch=!asc:~%xx%,1!
set word=!word!!ch!
shift
goto :get
:disp
echo !word!

Report •

#8
June 4, 2010 at 14:01:50
That's just slick, and much more elegant and lightweight! I did add in the conditional checking for printable characters only, testing %xx% LSS 32 and %xx% GTR 127, shifting those decimals out...

Report •

#9
June 4, 2010 at 14:52:27
One thing puzzles me. You said: "Yes, I think EnableDelayedExpansion is required to set the
passed variable name's value at the end."

Are you sure? What happens when you try this:

ENDLOCAL & SET %variable%=%value%

What is happening here is that first the variables are expanded so you get:

ENDLOCAL & SET xxx=Hello world!

and then it executes ENDLOCAL, so when you then call SET it sets xxx as a global variable.

If this works, you can do the whole thing without using delayed expansion.


Report •

#10
June 4, 2010 at 17:28:44
If not for the end variable expansion, then possibly for the
concatenation of the values as it loops through the arguments:

SET value=!value!!number!

or in nbrane's much smaller version:

set word=!word!!ch!


Report •

#11
June 4, 2010 at 18:24:21
@op: thanks! encouragemt alws welcome!
correct me, i may be full of it! Lol! but endlocal erases all
activity from the current level of 'setlocal' (either new variables values, or mod.s to existing inherited variables). The only way to set an environment (ie: "global") variable is to do so with no (as in zero) setlocals in effect. So whenever you "go up" a level, you have no access to modify global/environment vars values. They are in effect "read-only". Endlocal is unsurmountable except via squib-file (>> temp echo !xx!) for recovery at lower levels.
(it's like a check valve or a black hole: you can pass stuff up-channel, but never retrieve anything back.)
I've run up against this barrier numerous times. If someone
out there knows a solution, please! correct me!

Report •

#12
June 4, 2010 at 19:15:54
This bit seems to go through unscathed:

SET number=!number:32= !
SETLOCAL DISABLEDELAYEDEXPANSION
SET number=%number:33=!%
ENDLOCAL
SETLOCAL ENABLEDELAYEDEXPANSION
SET number=!number:34="!
SET number=!number:35=#!

Setting EndLocal anywhere else results in a bunch of errors.
I'm not in the habit of using a bunch of SetLocals/EndLocals,
so I can't comment from experience...

What gets me is that I setup the d2c batch file with the
intention of CALLing from other batches, with the expectation
being the GOTO :EOF would retain the final output, and the
value passed/returned back to the original batch, as it does
when CALLing a (local) :Label. No such luck. I resorted to
using:

<WMI stuff to get wireless nic's decimal ssid>
FOR /F "delims=" %%a IN ('d2c !raw_ssid!') DO (
	SET ssid=%%a
)

to get the coveted readable string value back.


Report •

#13
June 4, 2010 at 21:13:21
might want to double-check that your script's not getting
feedback from global (environment).
mine (winXP sp2) won't pass back the exclamation pt. (or
indeed, any value) to a "lower" level.

SETLOCAL DISABLEDELAYEDEXPANSION
SET number=%number:33=!%
:: this temporarily sets the var with the exclm.
ENDLOCAL
:: this (above) erases the exclm permanently?
SETLOCAL ENABLEDELAYEDEXPANSION
:: this does not recover it? because it's a parallel and not
:: a serial...
try this and see:

:: foll line is critical!!
set test=
setlocal enabledelayedexpansion
set test=abc
echo !test!
setlocal disabledelayedexpansion
set test=!%test%!
echo locl dis:
echo %test%
endlocal
echo endlocal:
echo %test%
echo !test!
setlocal enabledelayedexpansion
echo locl enb:
echo !test!


Report •

#14
June 5, 2010 at 01:55:01
See next post!

Report •

#15
June 5, 2010 at 03:38:05
Edit: Also works as an inline subroutine/found+fixed eol issue.

I think I have cracked it ;)

Usage:
call d2c.bat ssid !raw_ssid!
Or:
call :d2c ssid !raw_ssid!


@echo off
:d2c
if "%~2"=="" exit /b
if "!"=="" (
    setlocal disabledelayedexpansion
    set caret=true
) else (
    setlocal disabledelayedexpansion
    set caret=
)

set list=
:argloop
if "%~2"=="" goto change
for /f "delims=0123456789" %%a in ("%~2") do (
    shift /2
    goto argloop
)
if %~2 geq 32 if %~2 leq 126 for %%a in ("%list%	%~2") do set list=%%~a
shift /2
goto argloop


:change
if not defined list exit /b
for %%a in ("32= ","35=#","36=$","39='","40=(","41=)","43=+","44=,","45=-", "46=.","47=/" ) do call set list=%%list:%%~a%%
for %%a in ("48=0","49=1","50=2","51=3'","52=4","53=5","54=6","55=7","56=8", "57=9") do call set list=%%list:%%~a%%
for %%a in ("58=:","59=;","61==","64=@","65=A","66=B","67=C","68=D","69=E","70=F") do call set list=%%list:%%~a%%
for %%a in ("71=G","72=H","73=I","74=J","75=K","76=L","77=M","78=N","79=O","80=P") do call set list=%%list:%%~a%%
for %%a in ("81=Q","82=R","83=S","84=T","85=U","86=V","87=W","88=X","89=Y","90=Z") do call set list=%%list:%%~a%%
for %%a in ("91=[","92=\","93=]","95=_","96=`","97=a","98=b","99=c","100=d","101=e") do call set list=%%list:%%~a%%
for %%a in ("102=f","103=g","104=h","105=i","106=j","107=k","108=l","109=m","110=n") do call set list=%%list:%%~a%%
for %%a in ("111=o","112=p","113=q","114=r","115=s","116=t","117=u","118=v","119=w") do call set list=%%list:%%~a%%
for %%a in ("120=x","121=y","122=z","123={","125=}","126=~") do call set list=%%list:%%~a%%


for /f "delims=" %%a in ("%list:38=&%") do set list=%%a
for /f "delims=" %%a in ("%list:42=*%") do set list=%%a
for /f "delims=" %%a in ("%list:60=<%") do set list=%%a
for /f "delims=" %%a in ("%list:62=>%") do set list=%%a
for /f "delims=" %%a in ("%list:63=?%") do set list=%%a
for /f "delims=" %%a in ("%list:94=^%") do set list=%%a
for /f "delims=" %%a in ("%list:124=|%") do set list=%%a
if defined caret (
    for /f "delims=" %%a in ("%list:33=^!%") do set list=%%a
) else for /f "delims=" %%a in ("%list:33=!%") do set list=%%a

setlocal enabledelayedexpansion

set list=!list:34="!
set list=!list:37=%%!
set list=!list:	=!
for /f "eol=	 delims=" %%a in ("!list!") do (
    endlocal
    endlocal
    set %~1=%%a
)
exit /b


Report •

#16
June 5, 2010 at 05:30:40
@nbrane -
I think exclamation being an environmental was indeed the
case. A new command prompt gets this:

C:\>call d2c garbage before decimals 72 101 108 108 111 32 
87 111 114 108 100 33 32 72 111 119 32 121 97 32 100 111 
105 110 63 garbage after decimals
Hello World33 How ya doin?

Your substring method works flawlessly:

C:\>call d2c.test garbage before decimals 72 101 108 
108 111 32 87 111 114 108 100 33 32 72 111 119 32 121 97 
32 100 111 105 110 63 garbage after decimals
Hello World! How ya doin?

@Judago -
I think the only problem would be is the last SET after the
EndLocals. If the passed variable name is "path",
"homedrive", or other environment variable name, I'd be broken :-(


Report •

#17
June 5, 2010 at 06:04:05
I think the only problem would be is the last SET after the
EndLocals. If the passed variable name is "path",
"homedrive", or other environment variable name, I'd be broken :-(


That's easily fixed, it could be done with a list and "if /i "%~1"=="path" ect.,or perhaps something like this at the top of the script:

if defined %~1 (
    1>&2 Echo For security reasons only undefined
    1>&2 echo variables will be accepted. To "undefine"
    1>&2 echo you variable simply:
    1>&2 echo.
    1>&2 echo "set variable="
    1>&2 echo where no text comes after "="
    1>&2 echo.
    1>&2 echo Be sure not to use system variables.
    exit /b
)

That being said you have the same risk in *any* script that sets to environment variables, including the calling one. Good thing any changes made to any variable are lost on process exit, so at least it can't do much damage.

Your free to choose whatever suits you best of course, I think that's the whole idea ;)


Report •

#18
June 5, 2010 at 09:16:03
I still think you can do all of this without using delayed expansion at all. Just use % everywhere instead of !. Without delayed expansion, your code can be a lot simpler.

@orangeboy: "If not for the end variable expansion, then possibly for the concatenation of the values as it loops through the arguments:"

No you can still use non-delayed expansion. You are not in a FOR loop. You are only using a GOTO loop, where all your statements are at the top level (not inside parentheses) and in that context you don't have to use delayed expansion.

@nbrane, #11: "The only way to set an environment (ie: "global") variable is to do so with no (as in zero) setlocals in effect"

Please revisit my earlier reply #9. You can define a global variable even if your batch file uses SETLOCAL. You just need to use the trick I show in #9.


Report •

#19
June 5, 2010 at 11:01:48
Good point about the FOR and GOTO loops!

Report •

#20
June 5, 2010 at 20:44:19
hello Klint!
you're right! Thanks man! This trick will probably save
me a lot of grief down the road. It is limited to non-enabled
which would not be an issue except that (i just learned today)
enabled allows alot more flexibility with the "nastys":
&<=>|
Judago coded around those, but it definitely takes some finesse (lacking in my case!) Being terminally lazy, i would
prob'ly use enabled and then resort to a squib-file for output.

Report •

#21
June 6, 2010 at 12:21:41
nbrane, you might want to read Judago's How-To. It has a lot of answers that may interest you on this topic.

Report •

#22
June 6, 2010 at 13:25:37
Nobody actually reads links do they? You should see the bounce rate on my site ;) I post a link(hopefully pertinent) and just before the thread gets a reply I get a 10sec bounce. To be fair some come back, and the links don't ever seem to die....

In regards to "nasties"/ability, double quotes always turnout the worst, they are what force the issue. They can be equally problematic matched or unmatched take these two strings:

""&""
""&"

The outer quotes can be considered an attempt to avoid issues and the rest a variable thwarting it:

set test="&"
echo "%test%"
set test="^&
echo "%test%"


Report •

#23
June 6, 2010 at 14:14:25
Judago: double quotes always turnout the worst
I've seen someone (possibly klint) do this before. . .
set "foo="bar"
echo %foo%


Report •

#24
June 6, 2010 at 14:20:17
Edited for posterity....

Razor2.3: I've seen someone (possibly klint) do this before. . .


I'm aware of that trick too, but I'm pretty sure that the quotes are parsed as blocks, so if another problem character happens between these blocks then the issues start; example:


set "foo="&bar"


Report •

#25
June 6, 2010 at 14:36:46
call :setFoo "&bar
set foo
goto :eof

:setFoo
set "foo=%~1"


Report •

#26
June 6, 2010 at 14:51:13
@Razor2.3

It can be broken(but so can most things batch):

call :setFoo ""l&bar

In addition to the possibility of being broken up into multiple arguments.

Part of what I was referring to(as per the original topic) is having a standard environment var with an arbitrary(ascii 32d - 126d) string already inside it and doing a ":str=rep" on it without failing regardless of the string. The quotes could be done first but then every some of the other :str=rep could fail.

That's why I said that it forces the issue(to use delayed expansion).

Edit: Forgot to mention that the quotes must be keep in addition to the successful :str=rep operation.

Edit 2:@Razor2.3, I hope I'm not out of line, my purpose isn't to show you up or anything of that nature.

Edit 3:I said every when I should have said some. Yay for the Swiss cheese post!


Report •

#27
June 6, 2010 at 17:03:16
yah, i decided i couldn't pass this one up. I left the dbl quotes
around the "ticking bombs" until the very last export (thanks
to Klint's suggestion). This should allow export of all the char.s, but i haven't tested all the combinations of characters.

::first, clear the environment var. before setlocal
set word=
@echo off & setlocal
set asc= !"#$%%^&'()*+,-./0123456789:;^<^=^>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^^_`abcdefghijklmnopqrstuvwxyz{^|}~€‚ƒ„…†‡ˆ‰Š‹ŒŽ‘’“”•–—˜™š›œžŸ ¡¢£¤¥¦§¨©ª«¬­®¯°±²´µ¶·¸¹º»¼½¾¿ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖ×ØÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõö÷øùúûüýþ
::asc1 is for display only
set asc1=" !"#$%%^&'()*+,-./0123456789:;^<^=^>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^^_`abcdefghijklmnopqrstuvwxyz{^|}~€‚ƒ„…†‡ˆ‰Š‹ŒŽ‘’“”•–—˜™š›œžŸ ¡¢£¤¥¦§¨©ª«¬­®¯°±²´µ¶·¸¹º»¼½¾¿ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖ×ØÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõö÷øùúûüýþ"
echo 234567890123456789012345678901234567890123456789012345678901234567890123456789
echo "%asc1%"
:get
set xx=%1
if "%xx%" equ "" goto :disp
if '%xx%' equ '' goto :disp
set /a xx-=32
set fu=1
call :%xx% 2>nul
if %xx% geq 7 set /a xx+=1
if %xx% geq 30 set /a xx+=1
if %xx% geq 32 set /a xx+=1
if %xx% geq 34 set /a xx+=1
if %xx% geq 67 set /a xx+=1
if %xx% geq 98 set /a xx+=1
set ch="%%asc:~%xx%,%fu%%%"
call :char %ch%
shift
goto :get
:char
set word=%word%%1
goto :eof
:disp
echo word is:%word%
endlocal & set word=%word:"=%
goto :eof
:6
:28
:29
:30
:62
:92
set fu=2
::------ end


Report •

#28
June 6, 2010 at 17:35:30
Judago: my purpose isn't to show you up or anything of that nature.
I should hope not; that's MY job! :P

Report •

#29
June 6, 2010 at 18:16:39
@nbrane

34 60 34

It doesn't make it to :disp without issues(set word=%word%%1), using %word:"=% you may as well not process 34 at all.

I hope I'm not nit picking too much ;)


Report •

#30
June 6, 2010 at 18:27:45
Not at all! I need to see my mistakes.
("but i haven't tested all the combinations of characters.")
obviously, should have tried the quotes first, Lol!

Report •

#31
June 7, 2010 at 17:12:34
taking one last "jab" at this mother:

set word=
@echo off & setlocal
::use any control char. after the exclam in foll. line. I used ctrl-X
set asc=" !#$%%^&'()*+,-./0123456789:;^<^=^>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^^_`abcdefghijklmnopqrstuvwxyz{^|}~€‚ƒ„…†‡ˆ‰Š‹ŒŽ‘’“”•–—˜™š›œžŸ ¡¢£¤¥¦§¨©ª«¬­®¯°±²´µ¶·¸¹º»¼½¾¿ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖ×ØÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõö÷øùúûüýþ
::asc1 is for display only
set asc1=" ! #$%%^&'()*+,-./0123456789:;^<^=^>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^^_`abcdefghijklmnopqrstuvwxyz{^|}~€‚ƒ„…†‡ˆ‰Š‹ŒŽ‘’“”•–—˜™š›œžŸ ¡¢£¤¥¦§¨©ª«¬­®¯°±²´µ¶·¸¹º»¼½¾¿ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖ×ØÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõö÷øùúûüýþ"
echo 01234567890123456789012345678901234567890123456789012345678901234567890123456789"%asc1%"
:get
set xx=%1
if "%xx%" equ "" goto :disp
set fu=1
call :%xx% 2>nul
set /a xx-=31
if %xx% geq 8 set /a xx+=1
if %xx% geq 31 set /a xx+=1
if %xx% geq 33 set /a xx+=1
if %xx% geq 35 set /a xx+=1
if %xx% geq 68 set /a xx+=1
if %xx% geq 99 set /a xx+=1
set ch="%%asc:~%xx%,%fu%%%"
call :char %ch%
shift
goto :get
:char
::echo ch:[%1]
set word=%word%%1
goto :eof
:disp
echo preformat word is:%word%
pause
endlocal & set word=%word:""=%
set word=%word:="%
:: this last step is debatable, since it "opens pandoras box"
:: of all the nasties stored inside. Might be better to leave it
:: "encapsulated" for the recipient to unwrap: remove boundary quotes:
set word=%word:~1,-1%
goto :eof
:38
:60
:61
:62
:94
:124
set fu=2


Report •

#32
June 7, 2010 at 23:14:59
I think you got it nbrane, I couldn't get it to break ;)

Report •


Ask Question