Search found 177 matches

by amel27
13 May 2011 04:06
Forum: DOS Batch Forum
Topic: A big question
Replies: 9
Views: 10168

Re: A big question

It doesn't depend of CRLF it is an effect of the missing closing bracket. A block with a missing closing bracket is completly ignored. Hi jeb, effect in the following: with CRLF at the end of this line/file script finished quickly... but without CRLF "hang" on seconds (on XP) or generate ...
by amel27
13 May 2011 01:34
Forum: DOS Batch Forum
Topic: Sort tokens within a string & Disable FOR /F EOL option
Replies: 9
Views: 16618

Re: Sorting tokens within a string

We need to be careful about the implicit pesky "eol" option with the FOR /F loop. I've seen some claims that "eol=" will disable it, but it actually sets the eol character to a quote. However I discovered just today that you can set the eol character to the same as your delimite...
by amel27
12 May 2011 18:59
Forum: DOS Batch Forum
Topic: "universal" %DATE% parser
Replies: 17
Views: 146548

Re: "universal" %DATE% parser

So a binary hex dump of the sorted Russian space delimited tokens would be: A3 A3 20 A4 A4 20 AC AC Did I get that right? Yes, it is correct dump. So you copy and paste the code into a Unicode document. You then temporarily set your code page to OEM 858 (Multilingual Latin 1 + Euro) which correspon...
by amel27
12 May 2011 07:21
Forum: DOS Batch Forum
Topic: How to kill two processes when there is no taskkill
Replies: 17
Views: 25728

Re: How to kill two processes when there is no taskkill

Is your suggestion suitable for all versions of Windows from XP Home and upwards ? I'm sorry, unfortunately, XP Home - unique system from XP which doesn't support this command (Vista Home support) Alternatively I can offer inject WSH small procedure in BAT (CMD code between /* and */, other - JS): ...
by amel27
12 May 2011 02:28
Forum: DOS Batch Forum
Topic: "universal" %DATE% parser
Replies: 17
Views: 146548

Re: "universal" %DATE% parser

amel27 - How did you post those (Cyrillic?) characters? Simple copy/paste from DOS, but my IE font is UTF-8. Thus, I can copy/paste text from IE to notepad, then save file as Unicode (UTF16LE), and convert this text file to appropriate OEM via BAT: @echo off for /f "tokens=2 delims=:" %%a...
by amel27
12 May 2011 01:21
Forum: DOS Batch Forum
Topic: How to kill two processes when there is no taskkill
Replies: 17
Views: 25728

Re: How to kill two processes when there is no taskkill

Hi, Alan.
CMD has native WMI client - WMIC.EXE:

Code: Select all

WMIC Process Where "Name='abc.exe' or Name='def.exe'" Call Terminate
Examples of WMIC commands for Windows .NET SERVER Family
by amel27
11 May 2011 23:11
Forum: DOS Batch Forum
Topic: Sort tokens within a string & Disable FOR /F EOL option
Replies: 9
Views: 16618

Re: Sorting tokens within a string

Hi, dbenham . Some reasons on the subject. Simple FOR command is not good method of substrings enumeration if wildcards presents in string, because this method design for files enum. More secure method - inserting <LF> (thanks jeb ) and enumerate via extend "FOR /F" command. A bit changed ...
by amel27
11 May 2011 01:54
Forum: DOS Batch Forum
Topic: "universal" %DATE% parser
Replies: 17
Views: 146548

Re: "universal" %DATE% parser

interesting topic, dbenham another way of sorting... but in reverse order: set "tokens=" for %%x in ("%%a %%b %%c" "%%b %%a %%c" "%%c %%a %%b" "%%a %%c %%b" "%%b %%c %%a" "%%c %%b %%a" ) do if "!tokens!" lss "%%~x&q...
by amel27
11 May 2011 00:26
Forum: DOS Batch Forum
Topic: A big question
Replies: 9
Views: 10168

Re: A big question

During experiments with labels and parentheses has come across the "magic" line of code, that "dements" CMD.EXE if it place at the end of BAT file without trailing CRLF.

Code: Select all

(.&:Any Text

I hope that somebody can explain such behavior.
by amel27
09 May 2011 04:34
Forum: DOS Batch Forum
Topic: Find the ECHO state
Replies: 6
Views: 8102

Re: Find the ECHO state

OKI, so we seem to have a strange bug in echo piped to find. it is not bug, it is by disign command to the left of a pipe run in separate CMD.EXE process, it is easy for checking up in task manager: @echo off ( echo pause>nul )|find /v "" Thus, echo display status of other CMD process, no...
by amel27
08 May 2011 09:05
Forum: DOS Batch Forum
Topic: Access complex parameters
Replies: 15
Views: 16333

Re: Access complex parameters

It is a way to create a parameter Yes, this is a way for pure transfer variable to internal procedure or nested BAT file via CALL. For this purpose we should prepare parameter correctly and we can automated this task, as above example show. But if BAT file start from third party external applicatio...
by amel27
07 May 2011 08:44
Forum: DOS Batch Forum
Topic: Access complex parameters
Replies: 15
Views: 16333

Re: Access complex parameters

Wow! I see, You have found a solution of a problem? Brilliant, jeb! @Echo Off SETLOCAL EnableDelayedExpansion set lf=^ set "var=Content!lf!Line2!lf!Line3" call:EscLF var 2 call myBatch %%var%% exit/b :EscLF %varName% %cnt% ::-------------------- for /l %%i in (1,1,%~2) do (set "%~1=!%...
by amel27
07 May 2011 00:28
Forum: DOS Batch Forum
Topic: How to replace "=","*", ":" in a variable
Replies: 34
Views: 287867

Re: How to replace "=","*", ":" in a variable

The problem of replacing "=" it is possible to connect to problem of associative arrays. One solution is using variable Name as KEY and Value as DATA. Only <LF> not supported in variable name. The idea consists in sequentially splitting a line into a variable NAME and VALUE by every "...
by amel27
05 May 2011 03:56
Forum: DOS Batch Forum
Topic: Access complex parameters
Replies: 15
Views: 16333

Re: Access complex parameters

Is it possible to access the complete content of parameters, if they are contain a <CR> or <LF> characters? In my tests about %* substitution all <CR> trimmed and <LF> replace to <CRLF>, therefore command line splitted to lines with leading and trailing space. Caller code: @Echo Off SetLocal Enable...
by amel27
04 May 2011 21:15
Forum: DOS Batch Forum
Topic: Access complex parameters
Replies: 15
Views: 16333

Re: Access complex parameters

As you can see, in the first call of myBatch.bat the parameters are 'hello<LF>you111', but for the second and third loop they are '!var2!222' and '!var2!333'. as explain above, at the end of each myBatch ENDLOCAL executed, for full expanded Caller must be start via CMD /V:ON /C Caller and there are...