Search found 2429 matches

by dbenham
09 Jun 2011 09:41
Forum: DOS Batch Forum
Topic: Trying to create a data cleaning batch file
Replies: 4
Views: 4210

Re: Trying to create a data cleaning batch file

Now I'm running into a problem with how it is handling ! since I'm using the ENABLEDELAYEDEXPANSION setting. You can also run into problems if the name contains ^. The solution is to transfer the FOR loop variable to a normal variable with delayed expansion disabled, and then do the remainder of th...
by dbenham
08 Jun 2011 22:39
Forum: DOS Batch Forum
Topic: Hey scripting gurus...
Replies: 8
Views: 7198

Re: Hey scripting gurus...

allal It sounds like you are set with powershell. But there is an easy .bat solution known to this site that I'm surprised no one responded with. I think I learned this from a jeb post. I put a ping delay in to simulate some operation that takes time: @echo off (<nul set/p=Hello )&(>nul ping 1.1...
by dbenham
08 Jun 2011 19:47
Forum: DOS Batch Forum
Topic: DOSKEY
Replies: 16
Views: 16050

Re: DOSKEY

That is what the documentation says!

Dave
by dbenham
08 Jun 2011 19:32
Forum: DOS Batch Forum
Topic: DOSKEY
Replies: 16
Views: 16050

Re: DOSKEY

Cleptography wrote:So, how can we use DOSKEY in a script?
Is this possible?

No. DOSKEY Macros Must Be Executed from the Command Prompt

Dave Benham
by dbenham
08 Jun 2011 19:16
Forum: DOS Batch Forum
Topic: For loop question
Replies: 7
Views: 6501

Re: For loop question

Thanks Dave but what if im not doing with associated file? I just want to echo them in column? I'm not sure I understand what you mean. A clear example showing what you want might help (and maybe what you don't want so we see the difference). I saw the reference to columns in your 1st post but it w...
by dbenham
08 Jun 2011 19:10
Forum: DOS Batch Forum
Topic: How to replace "=","*", ":" in a variable
Replies: 34
Views: 287921

Re: How to replace "=","*", ":" in a variable

I'm not setting them - no one can (at least not directly). They are (undocumented?) dynamic variables. The =C: variable tells you the current directory of the C: drive, even if you happen to be on drive D:. If you change the directory of drive :C, then the =C: value will change as well. However, it ...
by dbenham
08 Jun 2011 17:53
Forum: DOS Batch Forum
Topic: For loop question
Replies: 7
Views: 6501

Re: For loop question

You are getting what you asked for! change the files like so and it should become more obvious: sequence.xml xml_A xml_B img.txt img_1 img_2 Your code performs the 2nd loop for each value in the 1st loop (2x2=4 rows). You only want to keep the row in img.txt that matches the current row in sequence....
by dbenham
08 Jun 2011 16:31
Forum: DOS Batch Forum
Topic: How to replace "=","*", ":" in a variable
Replies: 34
Views: 287921

Re: How to replace "=","*", ":" in a variable

The setlocal DisableExtensions is the key OMG I've never seen a use for that option before. I saw Disable and just assumed DelayedExpansion. I see it working now (from home), thanks. I just discovered that =:: is NOT defined on my Vista 32bit machine at work It is defined on Vista 64bit at home. Ju...
by dbenham
08 Jun 2011 16:30
Forum: DOS Batch Forum
Topic: SETLOCAL continues after batch termination!
Replies: 3
Views: 8419

SETLOCAL continues after batch termination!

OK - I think this is kind of scary It is possible for a SETLOCAL within a batch file to remain in effect even after the batch file terminates! If two SETLOCAL are in effect and a fatal error occurs (any fatal error?), only the last SETLOCAL is ended. The first one remains in effect even after batch ...
by dbenham
08 Jun 2011 15:15
Forum: DOS Batch Forum
Topic: IF condition is completly ignored, but why?
Replies: 16
Views: 11773

Re: IF condition is completly ignored, but why?

Ok they are not necessary, but they do help :!:
Without quotes or escape the command fails.

Dave
by dbenham
08 Jun 2011 13:44
Forum: DOS Batch Forum
Topic: [solved] Merged input & output parameter in function ?
Replies: 4
Views: 4498

Re: [solved] Merged input & output parameter in function ?

The suggested new versions lose significant functionality compared to the original. They don't expand wildcards, nor do they normalize the path into a fully qualified path. They only make sure it doesn't end in \. For example, given a path of test.txt The original might come back with something like...
by dbenham
08 Jun 2011 05:34
Forum: DOS Batch Forum
Topic: Why does this not work
Replies: 7
Views: 6371

Re: Why does this not work

Cleptography wrote:set str=operation
if "%str%"==str echo.%str%

What is not working :?: Nothing happens as expected.

"operation" <> str so echo does not fire.

Dave Benham
by dbenham
07 Jun 2011 23:04
Forum: DOS Batch Forum
Topic: IF condition is completly ignored, but why?
Replies: 16
Views: 11773

Re: IF condition is completly ignored, but why?

Both failures seems to be an effect of the specialized parser of FOR and IF, as both parsers splits the line into different parts, and some parts supports delayed expansion, but not all. Yes, I ran into a variation of that recently. The following fails: setlocal enableDelayedExpansion set option=/I...
by dbenham
07 Jun 2011 23:01
Forum: DOS Batch Forum
Topic: How to replace "=","*", ":" in a variable
Replies: 34
Views: 287921

Re: How to replace "=","*", ":" in a variable

But I know how to access it setlocal DisableExtensions echo %=::% I didn't found a way to modify the value (always ::\ ) Did I get you Did you test Here is what I get on my machine from an interactive prompt: C:\test>echo %=::% %=::% This is what I get on my machine within a batch: echo %=::% Resul...
by dbenham
07 Jun 2011 13:37
Forum: DOS Batch Forum
Topic: IF condition is completly ignored, but why?
Replies: 16
Views: 11773

Re: IF condition is completly ignored, but why?

I got you you didn't test it. Yes you did I could have sworn I had tested that before, though obviously not that specific bit of code. This certainly demonstrates the danger of posting code based on memory, and without testing. My bad. Are you aware of a situation where the delayed expansion of a v...