Search found 27 matches

by mcnd
23 Oct 2015 14:32
Forum: DOS Batch Forum
Topic: How get data/time independent from localization
Replies: 107
Views: 131107

Re: How get data/time independent from localization

I think I have not seen this used in this topic. set "year=" for /f "tokens=1-6 delims=/: " %%a in ('robocopy "|" . /njh') do if not defined year ( set "year=%%a" & set "month=%%b" & set "day=%%c" set "hour=%%d" & set ...
by mcnd
16 Oct 2015 11:49
Forum: DOS Batch Forum
Topic: rem overflow
Replies: 4
Views: 3819

Re: rem overflow

Not the first time it bites. Do you think this is related? More than a rem overflow I think it is a parser buffer overflow. What I see it that the parser will remove the starting rem and the initial delimiter (the first space) so the ampersand falls in the position 8192, the buffer is splitted at th...
by mcnd
13 Jul 2015 04:12
Forum: DOS Batch Forum
Topic: Is it legal for a Bat script to delete itself.
Replies: 15
Views: 20637

Re: Is it legal for a Bat script to delete itself.

Just for completion, as it has not been posted, and under the assumption that there is no CALL in progress inside the batch file to be deleted @"%~f0">"%~f0" && del "%~f0" It is a similar idea to the dbenham's (GOTO) code, leave the current batch context to be a...
by mcnd
22 Jun 2015 04:24
Forum: DOS Batch Forum
Topic: Need help synchronizing files between servers.
Replies: 17
Views: 10894

Re: Need help synchronizing files between servers.

More tests, some process profiling and some debug later. Instead of trying to remove the efect of the cache, I've made repetitive queries to ensure "all"? of the file/folder structure is cached by the OS, suspended almost anything else and then executed the tests to see if there is a signi...
by mcnd
19 Jun 2015 12:41
Forum: DOS Batch Forum
Topic: Need help synchronizing files between servers.
Replies: 17
Views: 10894

Re: Need help synchronizing files between servers.

Or are you saying that file a.txt is buffered and that's why it is faster? Yes. Just after a restart, with idle machine, from a fresh cmd instance 19/06/2015 20:14 51.985.984 data.txt D:> gett for /f "delims=" %a in (data.txt) do @rem 0 days 00:00:11.344 Presione una tecla para continuar ...
by mcnd
19 Jun 2015 05:10
Forum: DOS Batch Forum
Topic: Need help synchronizing files between servers.
Replies: 17
Views: 10894

Re: Need help synchronizing files between servers.

I read in another post that this space is assigned in chuncks of a certain small size, and each time that the space is not enough the previous data is moved to a new larger space! You are right, 4KB blocks (at least in windows 7). Each time the buffer is full, a new 4KB bigger buffer is allocated, ...
by mcnd
24 May 2015 02:29
Forum: DOS Batch Forum
Topic: Problem with if statements
Replies: 10
Views: 6520

Re: Problem with if statements

cadab321 wrote:... it automatically resets your health to full, even if you didn't get that much health.


Maybe your problem are the quotes. With them the gtr operator compares strings. Try with

Code: Select all

if %hp% gtr %maxhp% (
    set hp=%maxhp%
)
by mcnd
14 Apr 2015 09:42
Forum: DOS Batch Forum
Topic: Robocopy.exe fails with root directories and double quotes
Replies: 5
Views: 5231

Re: Robocopy.exe fails with root directories and double quot

This is the standard behaviour from the c runtime argument handling routines and logic used in most of the command line tools. ( https://msdn.microsoft.com/en-us/library/a1y7w461.aspx ) If you need to indicate the root folder, just use robocopy "c:\." "d:\."
by mcnd
28 Jan 2015 04:41
Forum: DOS Batch Forum
Topic: How to inherit the global path in a new command prompt
Replies: 4
Views: 4937

Re: How to inherit the global path in a new command prompt

Code: Select all

start /i cmd.exe


Where the /i switch instructs start command to use the original environment of the current cmd instance.
by mcnd
26 Jan 2015 11:44
Forum: DOS Batch Forum
Topic: Dir undocumented wildcards
Replies: 29
Views: 62946

Re: Dir undocumented wildcards

Just to be precise, the Undocumented wildcards term is not completely accurate. The [MS-FSA] File Systems Algorithms contains:

Algorithm for Determining If a Character Is a Wildcard
Algorithm for Determining if a FileName Is in an Expression
by mcnd
18 Nov 2014 10:21
Forum: DOS Batch Forum
Topic: JREPL.BAT v8.6 - regex text processor with support for text highlighting and alternate character sets
Replies: 550
Views: 2007334

Re: JREPL.BAT - regex text processor - successor to REPL.BAT

dave, Would it be possible to use Jrepl to remove duplicate lines (case sensitive) and leaving the lines in original order stripping blank lines as well. More or less ... Code edited to simplify the process jrepl "" "" /N 10 /f "inputFile" ^ | sort /+11 ^ | jrepl "...
by mcnd
08 Jan 2014 07:38
Forum: DOS Batch Forum
Topic: getDate function
Replies: 12
Views: 16427

Re: getDate function

Just for an alternative for the same code, without temporary files (and no, not on a clean XP, sorry) robocopy can be used @echo off setlocal enableextensions disabledelayedexpansion call :getDateTime echo year :%year% echo month :%month% echo day :%day% echo weekday :%weekday% echo hour :%hour% ech...