Search found 25 matches

by paultomasi
01 Dec 2011 15:22
Forum: DOS Batch Forum
Topic: help needed with interpreting strings and acting in response
Replies: 46
Views: 38601

Re: help needed with interpreting strings and acting in resp

Ed Dyreen

I hope we can learn to see eye-to-eye in future...

The reasons behind your style and their purpose have not gone unnoticed by me but I feel there is a time and place for complexity - just as there is a need for simplicity in some situations.

:)
by paultomasi
01 Dec 2011 15:04
Forum: DOS Batch Forum
Topic: help needed with interpreting strings and acting in response
Replies: 46
Views: 38601

Re: help needed with interpreting strings and acting in resp

orange_batch Yes. I do a lot of stuff often requiring arrays, multi-dimensional arrays, recursion, data crunching algorithms and code generation. Some of my projects include text-based games, compilers, parsers, filters, editors and library functions. My main interests are writing DOS extensions in...
by paultomasi
01 Dec 2011 14:23
Forum: DOS Batch Forum
Topic: help needed with interpreting strings and acting in response
Replies: 46
Views: 38601

Re: help needed with interpreting strings and acting in resp

Rileyh Apologies. I did intend to remove my previous reply when jeb pointed out your age to me - something I didn't even think to check myself. Given the circumstances, I apologies for the manner in which I conducted myself - it was inappropriate. I would prefer not to dwell on this matter any furt...
by paultomasi
30 Nov 2011 21:01
Forum: DOS Batch Forum
Topic: help needed with interpreting strings and acting in response
Replies: 46
Views: 38601

Re: help needed with interpreting strings and acting in resp

(Some comments were edited out by paultomasi) Rileyh @paultomasi When stating about Ed Dyreen, please refrain from being conceited. BTW- Ed Dyreen- expert Paultomasi- not expert So stating about the way that Ed codes in a conceited manner from your position is not reasonable- you are less experience...
by paultomasi
29 Nov 2011 06:29
Forum: DOS Batch Forum
Topic: help needed with interpreting strings and acting in response
Replies: 46
Views: 38601

Re: help needed with interpreting strings and acting in resp

Ed Dyreen Good program design is not just about getting code to work right - it also includes good layout. What I mean by that is: - consistency (comes with good practice and experience) - properly formatted layout using indentations etc. - good balance of white space - remarks - meaningful variabl...
by paultomasi
29 Nov 2011 05:55
Forum: DOS Batch Forum
Topic: help needed with interpreting strings and acting in response
Replies: 46
Views: 38601

Re: help needed with interpreting strings and acting in resp

Rileyh Apart from processing the one line in a file (the line containing: ' printline /a Hello world. '), do you actually need to process all the other lines too? If you don't then you could use FINDSTR to 'pick out' ' printline ' as in the following code: NOTE: Just copy & paste the code into n...
by paultomasi
29 Nov 2011 05:03
Forum: DOS Batch Forum
Topic: help needed with interpreting strings and acting in response
Replies: 46
Views: 38601

Re: help needed with interpreting strings and acting in resp

orange_batch

I agree with you on the force-of-habit thing...
by paultomasi
28 Nov 2011 07:23
Forum: DOS Batch Forum
Topic: help needed with interpreting strings and acting in response
Replies: 46
Views: 38601

Re: help needed with interpreting strings and acting in resp

when you say you want to access each part of the string separately, you can do the following (although it's not the way I would normally do it): for /f "tokens=1-26" %%a in ("%$$%") do ( echo %%a echo %%b echo %%c :etc... ) Notice I have no idea how many tokens there are in the s...
by paultomasi
27 Nov 2011 04:07
Forum: DOS Batch Forum
Topic: help needed with interpreting strings and acting in response
Replies: 46
Views: 38601

Re: help needed with interpreting strings and acting in resp

QUESTION 2:
How can I delimit the !$$! variable by its spaces (if it contains them) in this code:

For example:

Code: Select all

ECHO !$$:~ =!
will display the value of $$ with all of it's spaces suppressed.

If you want to actually remove the spaces then you can do the following:

Code: Select all

SET $$=!$$:~ =!
by paultomasi
27 Nov 2011 03:44
Forum: DOS Batch Forum
Topic: help needed with interpreting strings and acting in response
Replies: 46
Views: 38601

Re: help needed with interpreting strings and acting in resp

QUESTION 1: What is the difference between "%%~a" and "%%a"? If %%a includes double-quotes as part of it's value then %%~a suppresses them. This is of particular concern when we are adding double-quotes around %%a . If it's value already includes them then we end up with two lot...
by paultomasi
27 Nov 2011 02:59
Forum: DOS Batch Forum
Topic: multiple file type search
Replies: 9
Views: 9320

Re: multiple file type search

Don't for get to set your destination path after the '=' on the 2nd line or hardcode it into the xcopy command. @echo off set destination= echo %windir%>exclude.tmp for %%a in (doc pdf xls) do ( xcopy "*.%%a" "%destination%" /c /d:11-1-2011 /s /exclude:exclude.tmp ) del exclude.t...
by paultomasi
26 Nov 2011 17:18
Forum: DOS Batch Forum
Topic: multiple file type search
Replies: 9
Views: 9320

Re: multiple file type search

Try this simple batch file. change the second line to point to your own destination folder on drive D:.

Code: Select all

@echo off
set destination=d:\temp

md %destination% 2>nul

for %%a in (doc pdf xls) do (
  xcopy "*.%%a" "%destination%" /c /d:11-1-2011 /s
)
by paultomasi
26 Nov 2011 16:02
Forum: DOS Batch Forum
Topic: [SOLVED] SET /a -- Random Number?
Replies: 24
Views: 40076

Re: [SOLVED] SET /a -- Random Number?

Well said nitt however, let's look at the proper way to generate random numbers between (and including) 'min' and 'max'.

The following code will generate a random number between 5..10 inclusively:

Code: Select all

set min=5
set max=10
set /a range=max-min +1

set /a rnd=%random% %%%range% +%min%
echo %rnd%
by paultomasi
26 Nov 2011 15:54
Forum: DOS Batch Forum
Topic: help needed with interpreting strings and acting in response
Replies: 46
Views: 38601

Re: help needed with interpreting strings and acting in resp

jeb @echo off set append=abcd for /F "delims=" %%a in ("hello") do ( echo %%~a%append% ) There's absolutely no need to use a ' FOR /F '-loop with "delims=" to make your point. The following would have sufficed: @echo off set append=abcd for %%a in ("hello") d...
by paultomasi
26 Nov 2011 01:20
Forum: DOS Batch Forum
Topic: Capture trailing characters of a string based on a delimiter
Replies: 5
Views: 5535

Re: Capture trailing characters of a string based on a delim

A trick is to use the 'filename' property of a FOR's '%'-variable as in the following example: set script=fail back,Apex Production department,SUPER\QWERTY\KEYBOARDe\VM for /f "delims=" %%a in ("%script%") do echo %%~na This will display: VM So, getting the required values from y...