Search found 27 matches

by mcnd
18 Aug 2017 03:11
Forum: DOS Batch Forum
Topic: Manually compressing batch files
Replies: 5
Views: 1636

Re: Manually compressing batch files

The only strange trick... Really nice trick . Using that, following the basic compression idea of removing repeating sequences, most of the repeating elements inside the code can be move to the arguments for the second cmd instance %1@cmd/q/e/v/c"%~f0" : set .18.3.n .16.7.n .14.11.n %2 c=...
by mcnd
10 Aug 2017 01:09
Forum: DOS Batch Forum
Topic: Incrementing folder modification time based on an ordered folder list
Replies: 6
Views: 1300

Re: Incrementing folder modification time based on an ordered folder list

I had the same idea, but if you delete the temporary file, I think the folder timestamp will be re-modified. You are right, it is changed to current time when the file is created and changed again to current time when the file is deleted. While the proposed code does not follow the 1 second increme...
by mcnd
09 Aug 2017 04:04
Forum: DOS Batch Forum
Topic: Incrementing folder modification time based on an ordered folder list
Replies: 6
Views: 1300

Re: Incrementing folder modification time based on an ordered folder list

For the folder part, isn't it enough to iterate over the list of folders, in the required order, creating and deleting a temporary file inside each one? This "should" change the folder last modified time. The files can be updated with a simple `copy` command @echo off setlocal enableextens...
by mcnd
09 Aug 2017 03:28
Forum: DOS Batch Forum
Topic: Manually compressing batch files
Replies: 5
Views: 1636

Re: Manually compressing batch files

2017/08/09 As a first try @setlocal enabledelayedexpansion&set n=#^ &set c=fedcba&set f=&for /l %%a in (1 1 21) do @set f=!f! &set %%a=!f! :s @cls&echo!21!!n!!18!#!3!!n!!16!#!7!!n!!14!#!11!!n!!12!#!5!DISCO^^!!4!!n!!14!#!11!!n!!16!#!7!!n!!18!#!3!!n!!20!!n!&color !c:~-1!&am...
by mcnd
24 Feb 2017 16:15
Forum: DOS Batch Forum
Topic: Redirection to log file is quicker than to null : Why?
Replies: 18
Views: 3256

Re: Redirection to log file is quicker than to null : Why?

I was bitten by the same problem some time ago.

At that moment I didn't have the needed time to do more tests and I forgot it. Anyway I tested it in XP, 7 32b and 7 64b and in all of them the type and dir commands redirected to nul were much slower than redirected to a file.
by mcnd
11 Feb 2017 11:30
Forum: DOS Batch Forum
Topic: Some undocumented things with turned off command extensions
Replies: 12
Views: 2324

Re: Some undocumented things with turned off command extensions

COLOR, ASSOC and FTYPE are associated to command extensions but are not documented as dependent on them.
by mcnd
30 Jan 2017 05:46
Forum: DOS Batch Forum
Topic: What is "=::" and does its value ever changes?
Replies: 13
Views: 4612

Re: What is "=::" and does its value ever change?

After some tests in W10 64bits ⋅  The variable does not exists at the start ⋅ After having started a cmd instance as administrator (right button on task bar icon), new cmd instances (non admin) executed with Win+R or from start menu show the variable. ⋅ Once the variabl...
by mcnd
04 Dec 2016 05:41
Forum: DOS Batch Forum
Topic: SendMessage.exe: Access to advanced Windows features
Replies: 19
Views: 7725

Re: SendMessage.exe: Access to advanced Windows features

Nice utility, thank you for the work and the invitation. I think that in your initial list of messages to you missed this @echo off setlocal enableextensions disabledelayedexpansion SendMessage 258 84 SendMessage 258 101 SendMessage 258 115 SendMessage 258 116 set /p "=What is this? " Wher...
by mcnd
25 Jan 2016 03:15
Forum: DOS Batch Forum
Topic: %~x0 is Null if Batch is executed with quotes.
Replies: 7
Views: 2744

Re: %~x0 is Null if Batch is executed with quotes.

Maybe this (http://stackoverflow.com/a/26851883/2861476) could help. As far as I know, the penpen's answer is the only reliable way to ensure you retrieve a valid reference to the current batch file.
by mcnd
10 Dec 2015 13:56
Forum: DOS Batch Forum
Topic: Dir undocumented wildcards
Replies: 29
Views: 21251

Re: Dir undocumented wildcards

Squashman wrote:Can someone test this stuff on Windows 10. Seems like some of them do not work according to a reply to one of my answers on StackOverFlow.
http://stackoverflow.com/a/34206104/1417694


Tested and working on Windows 10.0.10586 (64 bits spanish locale)
by mcnd
04 Nov 2015 04:56
Forum: DOS Batch Forum
Topic: Optimizing These Loops
Replies: 31
Views: 5200

Re: Optimizing These Loops

I didn't want to say, that i don't know the meaning of a "?" in a for command. I was sure of it. Excuse me if I was not clear enough, I was just trying to indicate why I used it. When writting the code my first try was to execute the inner for command without the wildcard, but I was unabl...
by mcnd
04 Nov 2015 03:36
Forum: DOS Batch Forum
Topic: Optimizing These Loops
Replies: 31
Views: 5200

Re: Optimizing These Loops

I'm a bit unsure, because of the question mark in "%%~a.%%~b?": When writing the code I was trying to use a dir command and filter the full list using the %currentdate% variable with findstr so the list is only retrieved once (a dir command with several masks execute several searchs, so I...
by mcnd
03 Nov 2015 08:37
Forum: DOS Batch Forum
Topic: Optimizing These Loops
Replies: 31
Views: 5200

Re: Optimizing These Loops

If your system has short names enabled, then you could try this @echo off setlocal enableextensions enabledelayedexpansion set "currentdate=11/03/2015" for /f "tokens=1,2 eol=|" %%a in (' dir *.rpt /a-d /-n ^| findstr /c:"%currentdate%" ') do for %%c in ("%%~a.%%~b...
by mcnd
24 Oct 2015 06:13
Forum: DOS Batch Forum
Topic: How get data/time independent from localization
Replies: 107
Views: 41965

Re: How get data/time independent from localization

..., though the info header with day of the week is missing (one of good features of robocopy). For a locale independed we can use set "year=" for /f "tokens=1-6 delims=/: " %%a in ('robocopy "|" . /njh') do if not defined year ( set "year=%%a" & set &quo...
by mcnd
23 Oct 2015 15:06
Forum: DOS Batch Forum
Topic: How get data/time independent from localization
Replies: 107
Views: 41965

Re: How get data/time independent from localization

Page3 viewtopic.php?p=29762#p29762 Page 4 shows that the output is language dependant Also, for me, with a limited user without rights over the root of the drive, the indicated command fails. Robocopy is not native to XP Yes, I know. Included here just for completion as I saw robocopy used in other...