Search found 174 matches

by siberia-man
08 Jan 2014 03:13
Forum: DOS Batch Forum
Topic: Ways to aware that some string contains a substrings
Replies: 24
Views: 12835

Re: Ways to aware that some string contains a substrings

The foxidrive suggestion is almost the best. But it doesn't work in some specific cases when NEEDLE contains "=" or "*" symbols (in addition to the existing troubles with few specific symbols). Read my first post =)
by siberia-man
07 Jan 2014 18:32
Forum: DOS Batch Forum
Topic: Ways to aware that some string contains a substrings
Replies: 24
Views: 12835

Re: Ways to aware that some string contains a substrings

I don't expect if someone solve the issue for me. I would like to discuss the possible solutions of the topic. As I've said above it is the academic interest only. For example working in bash I can use something like below: if echo $STACK | grep -q "$NEEDLE" ; then echo CONTAINS fi if grep...
by siberia-man
07 Jan 2014 17:21
Forum: DOS Batch Forum
Topic: Ways to aware that some string contains a substrings
Replies: 24
Views: 12835

Re: Ways to aware that some string contains a substrings

penpen
First of all I was looking for simple and short solutions. Any way, your suggestion is good enough to be called as native and the more reliable.
by siberia-man
07 Jan 2014 15:21
Forum: DOS Batch Forum
Topic: getDate function
Replies: 12
Views: 10686

Re: getDate function

Glad to meet again the solution well known for long time. I have tested it on Win XP/Vista/7 and it works fine with the following tiny improvement: set "rptfile=/specify/the/full/name/to/the/temp/file" for /f "tokens=3,4,5,6,7,8,9 delims=: " %%1 in ( ' makecab /d RptFileName^=&qu...
by siberia-man
07 Jan 2014 10:50
Forum: DOS Batch Forum
Topic: Ways to aware that some string contains a substrings
Replies: 24
Views: 12835

Re: Ways to aware that some string contains a substrings

ShadowThief wrote:findstr is native batch...

To be more clear... Talking about native batch I mean the CMD.EXE features only. In this case findstr is external command despite of that it is native thing in the operating systems.
by siberia-man
07 Jan 2014 10:30
Forum: DOS Batch Forum
Topic: Ways to aware that some string contains a substrings
Replies: 24
Views: 12835

Re: Ways to aware that some string contains a substrings

what you are doing is re-inventing the wheel You're absolutely right =). As foxidrive have said, I have academic interest: is there native batch facilities to achieve the target. Of course, I know about find/findstr as a tool for searching an example of strings (we could add to the list awk/sed/etc...
by siberia-man
07 Jan 2014 07:09
Forum: DOS Batch Forum
Topic: Ways to aware that some string contains a substrings
Replies: 24
Views: 12835

Ways to aware that some string contains a substrings

I am trying to study for myself the most reliable ways to know that some string contains another string. Seems that some points are behind batch stuff. Lets say we have two input string: STACK is a string to search in and NEEDLE is a string to be looked for. There are three answers. 1. STACK contain...
by siberia-man
03 Jan 2014 20:24
Forum: DOS Batch Forum
Topic: Gain MAC address by batch file
Replies: 6
Views: 10777

Re: Gain MAC address by batch file

ipconfig /all | filter_command "physical" Filtering (by find, findstr, awk or something else) of the ipconfig output is not reliable way because of dependency on user-defined and locale settings. But you can use it if you sure that all machines have identical locale settings. The followin...
by siberia-man
28 Dec 2013 00:10
Forum: DOS Batch Forum
Topic: Batch file to open windows explorer to last created file
Replies: 34
Views: 16112

Re: Batch file to open windows explorer to last created file

Hi Gibs, Sure, it's possible. for /f %%f in ( 'dir /a-d /o-d /b "%WINDIR%"' ) do ( explorer /select,"%WINDIR%\%%f" goto 1 ) :1 Little bit explanation dir - take the listing /a-d - everything but directories /o-d - sort by date/time (the newest first) /b - show filenames only expl...