Search found 2429 matches
- 14 Aug 2011 22:42
- Forum: DOS Batch Forum
- Topic: [SOLVED] @ForTEntireLine isn't preserving my line ?
- Replies: 8
- Views: 4859
Re: @ForTEntireLine isn't preserving my line ?
The macro only takes care of setting EOL and DELIMS options so that the entire line is treated as one token and no lines are skipped because of the leading character. You still have to worry about making sure special characters and standard token delimiters are either escaped or quoted. Since you ha...
- 14 Aug 2011 21:12
- Forum: DOS Batch Forum
- Topic: [SOLVED] @ForTEntireLine isn't preserving my line ?
- Replies: 8
- Views: 4859
Re: @ForTEntireLine isn't preserving my line ?
You need to escape the space between usebackq and eol. Go back and re-read the original post where jeb introduced how to set EOL = <LF>, and then read the responses to that post. I don't have the link handy, but it has been referenced many times. untested: set @ForTEntireLine=for /f ^^^"useback...
- 14 Aug 2011 21:03
- Forum: DOS Batch Forum
- Topic: Jdate2date macro - missing operand?
- Replies: 2
- Views: 3399
Re: Jdate2date macro - missing operand?
Oooh - you were so close When using SET /A, you don't need to expand the variables - the SET /A command will do it for you. In your Jdate2Date macro you MUST NOT expand the variables because computations after the comma depend on prior computations. This fails: SET /a L=%%~a+68569,N=4*!L!/146097,L=!...
- 14 Aug 2011 19:28
- Forum: DOS Batch Forum
- Topic: New technic: set /p can read multiple lines from a file
- Replies: 37
- Views: 59132
Re: New technic: set /p can read multiple lines from a file
Btw. Do I said that I'm totally excited You're indeed batch-crazy, jeb I'm with you jeb - This is fantastic. My favorite part is there is no longer a need to enable and disable delayed expansion with each loop iteration. This makes it MUCH easier for complex logic that requires variables set for on...
- 11 Aug 2011 14:51
- Forum: DOS Batch Forum
- Topic: Interesting expansion experiment
- Replies: 5
- Views: 6567
Re: Interesting expansion experiment
Corrected a bone-headed conclusion in a prior post - FOR variable modifiers are actually NOT case dependent. Sorry everyone.
Dave Benham
Dave Benham
- 10 Aug 2011 23:31
- Forum: DOS Batch Forum
- Topic: Manipulating directory string
- Replies: 7
- Views: 6707
Re: Manipulating directory string
This works: @echo off setlocal set /p DestPath=Enter a valid path: set DestPath call :getParent %DestPath% DestParent set DestParent exit /b :getParent path pushd "%~1" || exit /b cd.. set "%2=%cd%" popd exit /b Nice features: - validates the path - sets errorlevel and gives erro...
- 10 Aug 2011 13:27
- Forum: DOS Batch Forum
- Topic: Batch File performance - For Vs. Call
- Replies: 6
- Views: 5513
Re: Batch File performance - For Vs. Call
That makes two of us - I was beginning to worry about your results.Acy Forsyte wrote:Anyway Whew! I'm sane again.
You might want to modify your IN() clause to include %WORKDIR% as wellAcy Forsythe wrote:And %WORKDIR% is current dir, I was just being careful in my re-write just in case it ever isn't current dir.
Dave Benham
- 10 Aug 2011 11:31
- Forum: DOS Batch Forum
- Topic: Batch File performance - For Vs. Call
- Replies: 6
- Views: 5513
Re: Batch File performance - For Vs. Call
Is %WORKDIR% set to the current directory
If not then the two scripts are not equivalent
COPY /Y %1 "%WORKDIR%\%NEWDIR%\%1"
vs.
COPY /Y "%WORKDIR%\%%A" "%WORKDIR%\%NEWDIR%\%%A"
Dave Benham
If not then the two scripts are not equivalent
COPY /Y %1 "%WORKDIR%\%NEWDIR%\%1"
vs.
COPY /Y "%WORKDIR%\%%A" "%WORKDIR%\%NEWDIR%\%%A"
Dave Benham
- 10 Aug 2011 05:48
- Forum: DOS Batch Forum
- Topic: Batch File performance - For Vs. Call
- Replies: 6
- Views: 5513
Re: Batch File performance - For Vs. Call
My jaw dropped when I first read this. But I think I have an explanation. I think you are seeing differences in the time it takes to execute your identical IN() clause, not your modified DO clause. You would think since both versions have identical IN() clauses, the timing for that portion would be ...
- 10 Aug 2011 05:21
- Forum: DOS Batch Forum
- Topic: Find command most recently created file
- Replies: 4
- Views: 4885
Re: Find command most recently created file
Sorry - I think FIND /C "aborted" filename is faster than TYPE filename | FIND /C "aborted" . But I didn't test for differences in output. Just need to revert to your syntax. Also I reread your requirements and saw you wanted the most recent *.txt created . I was getting the most...
- 09 Aug 2011 23:58
- Forum: DOS Batch Forum
- Topic: text file with multiple rows to 1 row tab delimited or comma
- Replies: 1
- Views: 2047
Re: text file with multiple rows to 1 row tab delimited or c
The key trick is to output text without issuing a newline: <nul set /p = This will "echo" without a new line but leading spaces are stripped. Unfortunately I'm not aware of a way to preserve leading spaces. Complete solution if you don't care about preserving empty lines: @echo off setloca...
- 09 Aug 2011 23:39
- Forum: DOS Batch Forum
- Topic: why does this FOR statement output %f and this one doesn't?
- Replies: 4
- Views: 4315
Re: why does this FOR statement output %f and this one doesn
I still don't see the difference, apart from the obvious absence of "echo tw". Here are the outputs side by side C:\>x2 <ENTER> | C:\>x3 <ENTER> | C:\>for %f in (a b) do ( | C:\>for %f in (a b) do (echo %f ) echo %f | echo tw | ) | | C:\>( | C:\>(echo a ) echo a | a echo tw | ) | a | tw | ...
- 09 Aug 2011 22:49
- Forum: DOS Batch Forum
- Topic: why does this FOR statement output %f and this one doesn't?
- Replies: 4
- Views: 4315
Re: why does this FOR statement output %f and this one doesn
Both outputs look fine to me. They each echo a and b which corresponds to %f.
Dave Benham
Dave Benham
- 09 Aug 2011 22:32
- Forum: DOS Batch Forum
- Topic: Find command most recently created file
- Replies: 4
- Views: 4885
Re: Find command most recently created file
Code: Select all
for /f %%f in ('dir /b /o-d /tw d:\*.txt') do find /c "aborted" %%~ff & goto :quitLoop
:quitLoop
Dave Benham
- 06 Aug 2011 15:21
- Forum: DOS Batch Forum
- Topic: IF Statement Syntax
- Replies: 24
- Views: 15933
Re: IF Statement Syntax
Perfect simple solution jeb. I like it
Dave Benham
Dave Benham