Search found 2044 matches

by dbenham
21 Jun 2018 14:56
Forum: DOS Batch Forum
Topic: Creatively stupid ways to rename files with spaces to underscores
Replies: 9
Views: 79

Re: Creatively stupid ways to rename files with spaces to underscores

I gave the doskey macro a try. This was my results. C:\Users\Squashman\spaces>dir /b fu bar 1.txt s p aces.txt C:\Users\Squashman\spaces>renSpaceTo_ *.txt C:\Users\Squashman\spaces>dir /b fu_bar_1.txt s_p aces.txt C:\Users\Squashman\spaces>doskey /macros renSpaceTo_=cmd /c "@(call &for %F in ($*) d...
by dbenham
21 Jun 2018 13:44
Forum: DOS Batch Forum
Topic: Creatively stupid ways to rename files with spaces to underscores
Replies: 9
Views: 79

Re: Creatively stupid ways to rename files with spaces to underscores

Actually the simple FOR statement uses some form of buffering. If all of the matching files fit within the buffer, then newly appearing file names will never be processed. But if there are a lot of files, then the first set of files that fit in the buffer are processed. Then when the next set of fil...
by dbenham
21 Jun 2018 13:16
Forum: DOS Batch Forum
Topic: Creatively stupid ways to rename files with spaces to underscores
Replies: 9
Views: 79

Re: Creatively stupid ways to rename files with spaces to underscores

Interesting challenge. I've succeeded in surpassing your original requirements :) Here is a command line one liner that does not use any true environment variable, though it does use the dynamic pseudo environment variable %cmdcmdline%. Since it is command line, it obviously cannot use GOTO. cmd /c ...
by dbenham
28 Apr 2018 20:59
Forum: DOS Batch Forum
Topic: stamps
Replies: 25
Views: 831

Re: stamps

As promised, here is a version that allows you to easily modify the list of available stamps. Instructions for how to modify the list are at the bottom of the code. It is currently configured and optimized to quickly compute solutions for the original list of stamps. But the first time you run with ...
by dbenham
26 Apr 2018 15:14
Forum: DOS Batch Forum
Topic: stamps
Replies: 25
Views: 831

Re: stamps

Your code is too complicated to understand. Could you please make a list of stamps (values/display) more user friendly so new stamps could be added or removed with ease. One more thing: how can I use comma as a decimal point? If I replace '0.20' with '0,20' I get divide by zero. My new code at the ...
by dbenham
26 Apr 2018 09:31
Forum: DOS Batch Forum
Topic: more tricks with certutil
Replies: 2
Views: 247

Re: more tricks with certutil

:shock:
Wonderful - Thankyou :!: :D
by dbenham
25 Apr 2018 22:20
Forum: DOS Batch Forum
Topic: stamps
Replies: 25
Views: 831

Re: stamps

Thanks penpen. The failure comes from my erroneous 2nd postulate where I only allow a count of n or n-1 for any given denomination. I had to change the algorithm to allow each denomination to test more than 2 counts. It was surprisingly easy. I didn't spend much time trying to optimize the implement...
by dbenham
25 Apr 2018 12:22
Forum: DOS Batch Forum
Topic: stamps
Replies: 25
Views: 831

Re: stamps

I investigated the performance, and I'm pretty sure the maximum number of CALLs to :solve must be <=111 for any given number. I tested all values from 1 to 4000, and the maximum number of CALLs was 55, and the vast majority required between 30 and 50 calls. I looked at the results of running 1 to 40...
by dbenham
25 Apr 2018 10:24
Forum: DOS Batch Forum
Topic: stamps
Replies: 25
Views: 831

Re: stamps

I believe I have an efficient solution that quickly computes an optimal solution for any positive integral value supported by SET /A. Some values have multiple optimal solutions. My code finds the optimal solution with the highest possible number of D. My code is dependent on one additional postulat...
by dbenham
25 Apr 2018 05:26
Forum: DOS Batch Forum
Topic: stamps
Replies: 25
Views: 831

Re: stamps

Actual best solution for 460: 2 X D 2 X C 2 X 0.02 or 4 X C 1 X A 1 X 0.20 Your first best solution is wrong. It gives 456, not 460... Sorry, I was sloppy and used a value of D=128 instead of D=126 :oops: Ok. This is my second attempt: I did some comparisons with penpen's code, and your result for ...
by dbenham
24 Apr 2018 15:54
Forum: DOS Batch Forum
Topic: stamps
Replies: 25
Views: 831

Re: stamps

Impressive :!: 8)

Now I have to see if I can figure out how your code works :D
by dbenham
24 Apr 2018 14:25
Forum: DOS Batch Forum
Topic: stamps
Replies: 25
Views: 831

Re: stamps

It is a lot easier than coming up with a solution :lol: I'm not sure how to translate this into a calculus multi-variable max/min problem (or even if it is possible). Like aGerman, it has been nearly 40 years. And I don't think I would want to do that in batch anyway :wink: In lieu of that, this see...
by dbenham
24 Apr 2018 13:48
Forum: DOS Batch Forum
Topic: stamps
Replies: 25
Views: 831

Re: stamps

@Aacini - Nope :!: :twisted: Your result for 160: Possible solutions: 1- 5 stamps = 1@D 1@0.20 1@0.10 2@0.02 2- 4 stamps = 1@C 1@B 1@0.10 1@0.02 3- 6 stamps = 3@B 1@0.10 1@0.05 1@0.01 4- 4 stamps = 4@A 5- 8 stamps = 8@0.20 6- 16 stamps = 16@0.10 7- 32 stamps = 32@0.05 8- 80 stamps = 80@0.02 9- 160 s...
by dbenham
24 Apr 2018 11:31
Forum: DOS Batch Forum
Topic: stamps
Replies: 25
Views: 831

Re: stamps

All of the listed solutions give the following for 60:

1 X B
1 X 0,10
1 X 0,02

The correct answer should be :

1 X A
1 X 0,20


Dave Benham
by dbenham
23 Apr 2018 07:01
Forum: DOS Batch Forum
Topic: 'for' statement in macro will not accept 'tokens' argument from another 'for' statement. Why?
Replies: 5
Views: 252

Re: 'for' statement in macro will not accept 'tokens' argument from another 'for' statement. Why?

Because FOR /F options are parsed and interpreted before FOR variables are expanded. The fact that you are using FOR /F within a macro has nothing to do with the problem. It all makes sense if you study How does the Windows Command Interpreter (CMD.EXE) parse scripts? . You cannot use FOR variables ...