Search found 208 matches

by siberia-man
12 Jan 2014 03:50
Forum: DOS Batch Forum
Topic: Move files with condition
Replies: 15
Views: 13230

Re: Move files with condition

It is not clear from the first post whether .IMG and .XML should be moved consequentially or separately. So the code below implements moving of all available files FILENAME having the pair file called FILENAME.DONE. As I understood from the discussions .DONE files will be removed after movement of s...
by siberia-man
10 Jan 2014 08:07
Forum: DOS Batch Forum
Topic: BinToBat.bat - Easily install files of any type or size!
Replies: 26
Views: 41407

Re: BinToBat.bat - Easily install files of any type or size!

Aacini , you have posted very interesting solution at your first post. I've just began to learn it and found the weird code. Could you give more details on it? // Encode <number of spaces> while ( inputLine.charAt(spaces) == " " ) spaces++; if ( 3 <= spaces && spaces <= 29 ) { out...
by siberia-man
09 Jan 2014 00:10
Forum: DOS Batch Forum
Topic: Ways to aware that some string contains a substrings
Replies: 24
Views: 20419

Re: Ways to aware that some string contains a substrings

Squashman wrote:But then your script doesn't become very portable if others need to use it.

yes or not - depends on tasks. The proper organization of a code could minimize influence of environment. Moreover, we could hide all differences into configuration files.
by siberia-man
08 Jan 2014 07:33
Forum: DOS Batch Forum
Topic: Ways to aware that some string contains a substrings
Replies: 24
Views: 20419

Re: Ways to aware that some string contains a substrings

so why don't you show more on your specific cases. help us to help you. surely you can't expect others to guess what's happening right? have you ever read the points I have mentioned early? I began from the description of existing solutions and shown possible issues. If you want foolproof and simpl...
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: 20419

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: 20419

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: 20419

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: 16467

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: 20419

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: 20419

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: 20419

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: 14828

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: 25769

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...