IWETHEY v. 0.3.0 | TODO
1,095 registered users | 0 active users | 0 LpH | Statistics
Login | Create New User
IWETHEY Banner

Welcome to IWETHEY!

New Fun with DOS Batch
I can't recall the last time I wrote a dos batch file. So it only stands to reason, I can't remember how to do something simple. What I want to do is iterate through a list of files and do a copy command from one directory to another. The problem is that the iteration file list has a different file extension than the extension used for copy. Something along the lines of:
\n   FOR %%f in (*.dis) ECHO BASE(%%f).dat\n

So how do you do a function like BASE(fname)? It should take the value in the for loop and strip away the file extension. Short of that, are there some string manipulation functions where I can just strip the last n chars from the argument?

Thanks
New Check Garbo perhaps?
If you've got a copy of "PC Magazine: DOS Power Tools" with a working floppy, it probably has what you need.

Otherwise, check the [link|http://garbo.uwasa.fi/pc/batchutil.html|DOS batch] and at [link|http://garbo.uwasa.fi/pc/filecopy.html|file utilities] at Garbo.

HTH a bit.

Cheers,
Scott.
(Who's forgotten to much to be helpful.)
New Write a filter in QBASIC?
Regards,

-scott anderson

"Welcome to Rivendell, Mr. Anderson..."
New Why not do it in two steps
Can you copy the files to the new directory and then do a blanket rename *.dat *.dis?

If you can't then your best option will be to find some other scripting tool to install.

Jay
New Any other tool would be better.
But I did finally track down the solution from the links... buried in there somewhere.
\nFOR %%F in (*.dis) DO ECHO %%~nF.dat\n

Now maybe I can spend another 10 years not having to work with this abomination.
You'd think that the richest guy on the planet would go back and fix DOS, since that's how he stumbled into his fortune. But as near as I can tell, he's ashamed of his roots.
New Oh, come on.
You can do object oriented programming in DOS batch! What's not to like?
Regards,

-scott anderson

"Welcome to Rivendell, Mr. Anderson..."
New I actually went and looked at that code. :-)
New So it actually has SOME socially redeeming qualities, then.
Regards,

-scott anderson

"Welcome to Rivendell, Mr. Anderson..."
New There's a difference between "can" and "should"
===

Purveyor of Doc Hope's [link|http://DocHope.com|fresh-baked dog biscuits and pet treats].
[link|http://DocHope.com|http://DocHope.com]
     Fun with DOS Batch - (ChrisR) - (8)
         Check Garbo perhaps? - (Another Scott)
         Write a filter in QBASIC? -NT - (admin)
         Why not do it in two steps - (JayMehaffey) - (5)
             Any other tool would be better. - (ChrisR) - (4)
                 Oh, come on. - (admin) - (3)
                     I actually went and looked at that code. :-) -NT - (ChrisR) - (1)
                         So it actually has SOME socially redeeming qualities, then. -NT - (admin)
                     There's a difference between "can" and "should" -NT - (drewk)

I never seen a man eat so many chicken wings!
93 ms