Search found 6 matches

by miltos
29 Aug 2012 05:27
Forum: DOS Batch Forum
Topic: strip eol character of echo command
Replies: 2
Views: 3033

Re: disable eol character of echo command

never mind; I found something that works for me

@echo off
echo | set /p =salala > something.text
by miltos
29 Aug 2012 05:11
Forum: DOS Batch Forum
Topic: strip eol character of echo command
Replies: 2
Views: 3033

strip eol character of echo command

i want to redirect echo output to a file but without the eol char.

for example

echo salalalala > something.text

something.text contains

1 salalalala[CRLF]
2 [newline]

Is there any quick way to disable eol?
by miltos
28 Mar 2012 13:57
Forum: DOS Batch Forum
Topic: Split string to characters
Replies: 32
Views: 60533

Re: Split string to characters

Aacini wrote:This is another, simpler method:

Code: Select all

@echo off
set mystring=example
:loop
if defined mystring (
   echo(%mystring:~0,1%
   set "mystring=%mystring:~1%"
   goto loop
)


good
by miltos
28 Mar 2012 10:14
Forum: DOS Batch Forum
Topic: Split string to characters
Replies: 32
Views: 60533

Re: Split string to characters

Using call runs an extra CMD processor, and then the doubled quotes are reduced to single quotes. The %num% variable in the line replaced with the value. This allows you to use a variable where a variable is not designed to be used. This is one of the undocumented techniques used in batch files. al...
by miltos
28 Mar 2012 07:55
Forum: DOS Batch Forum
Topic: Split string to characters
Replies: 32
Views: 60533

Re: Split string to characters

Thanks; works like a charm! Just a question: why do I need call before set? I understand the script but i don't get how set and double quotation marks success running the script. I'm trying without call but i get errors What am I doing wrong? set name2=%name:~%num%,1% Just to satisfy my curiosity......
by miltos
28 Mar 2012 04:45
Forum: DOS Batch Forum
Topic: Split string to characters
Replies: 32
Views: 60533

Split string to characters

Although I can easily split a string using tokens delims. etc. i cannot split string to characters.

e.g.

set mystring=example
for /f ??????? %%i in ("%mystring%") do (
echo %%i
)

output should be:
e
x
a
m
p
l
e

your help is appreciated