batch file to change letters/% in txt

April 25, 2011 at 02:44:45
Specs: Windows 7
hi my english isnt good and computer knowledge isnt better lol

i got txt file with lines like those

%7B%22user%22%3A%22p|120524697%22%7D
i know that
%7B={
%22="
%3A=:
%7D=}

i tried to use this but it isnt working correct

::---
@echo off
SetLocal EnableDelayedExpansion
For /F "tokens=* delims=" %%A in (Textfile.txt) Do (
Set TxtLine=%%A
Set TxtLine=!TxtLine:%7B={!
Set TxtLine=!TxtLine:%22="!
Set TxtLine=!TxtLine:%3A=:!
Set TxtLine=!TxtLine:%7D=}!
echo !TxtLine!>>tmp.txt)
del Textfile.txt & ren tmp.txt Textfile.txt
::---


i wanted to get {"user":"p|120524697"}
but i got %7{%""user%""%3:%""p|1"05"4697%""%7}



See More: batch file to change letters/% in txt

Report •

#1
April 25, 2011 at 03:53:06
Double the %'s:

Set TxtLine=!TxtLine:%%7B={!
Set TxtLine=!TxtLine:%%22="!
Set TxtLine=!TxtLine:%%3A=:!
Set TxtLine=!TxtLine:%%7D=}!


Report •
Related Solutions


Ask Question