Search found 177 matches

by amel27
02 Jun 2011 20:34
Forum: DOS Batch Forum
Topic: Batch move files up one directory for multiple directories
Replies: 4
Views: 3279

Re: Batch move files up one directory for multiple directori

Code: Select all

@for /r "C:\TEST\ROOT" %%a in (.) do @(
  pushd "%%a"
  move * .. >Nul 2>&1
  popd
)
by amel27
30 May 2011 06:22
Forum: DOS Batch Forum
Topic: batch file to print tokens of different lines
Replies: 2
Views: 1296

Re: batch file to print tokens of different lines

@echo off SETLOCAL EnableDelayedExpansion set "fline=0" (for /f "usebackq tokens=*" %%x in ("file1.txt") do ( set/a "bline=1+fline%%6,block=1+fline/6,fline+=1" for /f "tokens=1-4" %%a in ("%%x") do ( if !fline! equ 1 echo %%x if !bline! eq...
by amel27
30 May 2011 06:00
Forum: DOS Batch Forum
Topic: Scanning file in blocks of lines
Replies: 7
Views: 1932

Re: Scanning file in blocks of lines

tebee wrote:so there is no special meaning for '$', or it has?
no, for convenience only
by amel27
30 May 2011 03:39
Forum: DOS Batch Forum
Topic: Set specific lines of text as a %variable%
Replies: 13
Views: 4064

Re: Set specific lines of text as a %variable%

dbenham wrote:I have read many times that GOTO begins scanning from the current location until it reaches the end of file, then resumes scanning from the top.

Nice thread. Thanks, Dave.
I am glad to appear wrong. :D
by amel27
30 May 2011 03:28
Forum: DOS Batch Forum
Topic: Scanning file in blocks of lines
Replies: 7
Views: 1932

Re: Scanning file in blocks of lines

tebee wrote:what's the meaning of
set "$a=%%a"
set content of current text line (in FOR loop) to variable $a

P.S. sorry, but my bad English doesn't allow me to be got involved in long discussions... :(
by amel27
29 May 2011 21:15
Forum: DOS Batch Forum
Topic: Set specific lines of text as a %variable%
Replies: 13
Views: 4064

Re: Set specific lines of text as a %variable%

Plus the GOTO label is placed immediately after the loop so there is minimal time scanning for it. no, GOTO always scan whole BAT from start to first occurence of label (it is my reason) @echo off for /l %%i in (1,1,10) do ( if %%i equ 3 set "var=1" & goto:BREAK :BREAK echo %%i ) set ...
by amel27
29 May 2011 20:13
Forum: DOS Batch Forum
Topic: Scanning file in blocks of lines
Replies: 7
Views: 1932

Re: Scanning file in blocks of lines

Oh, sorry... in examle 2 last block not processed, but we can move common code to procedure: @echo off set "bmax=40" set "file=test.txt" set "fline=0" for /f "usebackq delims=" %%a in ("%file%") do (set "$a=%%a" SETLOCAL EnableDelayedExpans...
by amel27
29 May 2011 19:51
Forum: DOS Batch Forum
Topic: circumvent findstr white space eol
Replies: 5
Views: 2908

Re: circumvent findstr white space eol

orange_batch wrote:Best (in this case):
('dir /b /o:d ^| findstr /i ".txt .doc .dat" ')
the best is:

Code: Select all

('dir/b/o:d^|findstr/i "\.txt \.doc \.dat" ')
;)
by amel27
29 May 2011 01:23
Forum: DOS Batch Forum
Topic: Set specific lines of text as a %variable%
Replies: 13
Views: 4064

Re: Set specific lines of text as a %variable%

for /f "usebackq skip=2 delims=" %%a in ("test.txt") do (set "valuefromtext=%%a" &goto exitFor) :exitFor I think, "If" is more preferably than "GoTo" (from reasons of speed): set "valuefromtext=" for /f "usebackq skip=2 delims=&qu...
by amel27
29 May 2011 00:34
Forum: DOS Batch Forum
Topic: Scanning file in blocks of lines
Replies: 7
Views: 1932

Re: Scanning file in blocks of lines

sample 1: @echo off set "bmax=40" set "file=test.txt" set "fline=0" del tmp for /f "usebackq delims=" %%a in ("%file%") do (set "$a=%%a" SETLOCAL EnableDelayedExpansion set/a "bline=1+fline%%%bmax%,block=1+fline/%bmax%,fline+=1" (...
by amel27
28 May 2011 23:48
Forum: DOS Batch Forum
Topic: circumvent findstr white space eol
Replies: 5
Views: 2908

Re: circumvent findstr white space eol

Code: Select all

@echo off
setlocal EnableDelayedExpansion

for /f "delims=" %%h in ('dir/b/o:d^|findstr/i ".txt .doc .dat"') do (
  set "example=%%h"
  echo !example!>>tmp
)
by amel27
15 May 2011 07:35
Forum: DOS Batch Forum
Topic: Sort tokens within a string & Disable FOR /F EOL option
Replies: 9
Views: 6377

Re: Sorting tokens within a string

Many thanks, dbenham for exhaustive information. :)
by amel27
14 May 2011 20:48
Forum: DOS Batch Forum
Topic: "universal" %DATE% parser
Replies: 17
Views: 9873

Re: "universal" %DATE% parser

dbenham wrote:I've determined that my most recent post of the full code was using Windows 1252 character set (CHCP 1252).
Hm.. 1252 is ANSI (1-byte), but if I switch my browser to any ANSI/DOS font, russian chars in yor posts takes 2 bytes... :?
by amel27
14 May 2011 02:35
Forum: DOS Batch Forum
Topic: "universal" %DATE% parser
Replies: 17
Views: 9873

Re: "universal" %DATE% parser

But because this forum doesn't support attachments, you are unable to get the binary image directly. On the other hand, we can reproduce the binary data via script (WSH for example). This BAT regenerate itself to new BAT file from this post. @set @x=0 /* @echo off set "MAP="& set &quo...
by amel27
13 May 2011 04:13
Forum: DOS Batch Forum
Topic: I know it's VBScript, but about eval()...
Replies: 1
Views: 1416

Re: I know it's VBScript, but about eval()...

Code: Select all

wscript.echo eval(wscript.arguments(0)&"&""cake""")