Search found 24 matches

by davep
10 Aug 2015 18:08
Forum: DOS Batch Forum
Topic: Using Variable As For-Loop Token Value
Replies: 7
Views: 11387

Re: Using Variable As For-Loop Token Value

Wonderful solution, Dave. I'll try it out asap. Thank you!
by davep
03 Jun 2015 12:16
Forum: DOS Batch Forum
Topic: Using Variable As For-Loop Token Value
Replies: 7
Views: 11387

Re: Using Variable As For-Loop Token Value

Excellent! Thank you!
by davep
03 Jun 2015 11:31
Forum: DOS Batch Forum
Topic: Using Variable As For-Loop Token Value
Replies: 7
Views: 11387

Using Variable As For-Loop Token Value

Hello batchers! I'm trying to split a path string, and I've run into an issue where using %var% as a token value works as expected, but !var! does not: @echo off setlocal enableextensions setlocal enabledelayedexpansion set "file=E:\temp\TEST\123458--text_text1\filename.mp4" set tokenNum=4...
by davep
08 Jun 2010 13:26
Forum: DOS Batch Forum
Topic: get drive letters & drive types, if fixed drive, run dirms
Replies: 5
Views: 8003

Re: get drive letters & drive types, if fixed drive, run dir

It works for the first fixed drive (C:) but doesn't make it to the second fixed drive (E:) on my workstation. I've also learned that while dirms.exe is fast and thorough, it doesn't always exit gracefully. I have replaced it with a call to XP-native file defrag.exe.

Thanks!
by davep
07 Jun 2010 20:41
Forum: DOS Batch Forum
Topic: get drive letters & drive types, if fixed drive, run dirms
Replies: 5
Views: 8003

Re: get drive letters & drive types, if fixed drive, run dir

Looks great! I knew it would be simple like that. I'll try it out when I get to the office in the morning. Thanks!
by davep
07 Jun 2010 15:22
Forum: DOS Batch Forum
Topic: get drive letters & drive types, if fixed drive, run dirms
Replies: 5
Views: 8003

Re: get drive letters & drive types, if fixed drive, run dir

Thanks! We're getting closer. I'm having trouble getting that to work. Rehearsing some commands before committing to batch tells me that something about the for/if statement is amiss. Hint: fsutil... generates C:\ and dirms.exe only needs C. Also, the blank space before "Fixed Drive" may b...
by davep
07 Jun 2010 12:42
Forum: DOS Batch Forum
Topic: get drive letters & drive types, if fixed drive, run dirms
Replies: 5
Views: 8003

get drive letters & drive types, if fixed drive, run dirms

I'm working on a batch that can get the drive letters and drive types via fsutil fsinfo ... but I'm stuck with the if logic that follows. If the drive type is fixed, I'd like to run a defrag utility called dirms.exe. Once this is solved, I'd have one batch file that can run as a scheduled task on ev...
by davep
01 May 2009 10:11
Forum: DOS Batch Forum
Topic: Recreating an IBM XT with batch programming
Replies: 6
Views: 9234

You just need another batch file with something like this:

Code: Select all

@echo off
type "C:\start.txt"
ping localhost -n 10 2>&1>nul


It should hang around for a few seconds and then close.
by davep
30 Apr 2009 12:07
Forum: DOS Batch Forum
Topic: For Loop to Retrieve Average File Sizes
Replies: 9
Views: 12731

Done. Works nicely. Thanks everyone!
by davep
30 Apr 2009 11:42
Forum: DOS Batch Forum
Topic: Recreating an IBM XT with batch programming
Replies: 6
Views: 9234

Maybe something like this?

Code: Select all

@echo off

for /l %%X in (1,1,16000) do (
   cls
   echo.%%X
   )
echo.
pause


The pause is optional, of course. Also, you can echo ASCII art for the IBM logo, but the screen will flicker a lot due to the very fast counting coupled with cls.
by davep
29 Apr 2009 14:59
Forum: DOS Batch Forum
Topic: For Loop to Retrieve Average File Sizes
Replies: 9
Views: 12731

Upon further testing, I've found a loophole. If file not found, the last known "good" data will be displayed twice. --------------------------------- Found 1 *.txt files Average Size is: B 468998524 KB 458006.371 MB 447.271847 GB 0.436788913 --------------------------------- File Not Found...
by davep
29 Apr 2009 14:21
Forum: DOS Batch Forum
Topic: For Loop to Retrieve Average File Sizes
Replies: 9
Views: 12731

Bingo!

Perfect, sir! You've done it again! Here's the results: --------------------------------- Found 2 *.log files Average Size is: B 18932546.5 KB 18488.8149 MB 18.0554833 GB 0.017632308 --------------------------------- Found 2 *.txt files Average Size is: B 28359080.5 KB 27694.4146 MB 27.0453267 GB 0....
by davep
29 Apr 2009 13:55
Forum: DOS Batch Forum
Topic: For Loop to Retrieve Average File Sizes
Replies: 9
Views: 12731

@RElliot63: Thanks for the nudge in the right direction. I forsee a tweak or two to get your code to merged with mine. For example, how would I keep the set LOC line I originally had? I need that, or something similar, so I can send the script to a coworker and let him choose the server and path, an...
by davep
28 Apr 2009 20:01
Forum: DOS Batch Forum
Topic: For Loop to Retrieve Average File Sizes
Replies: 9
Views: 12731

For Loop to Retrieve Average File Sizes

Hello all, I'm trying to get the average file size of three file types within a folder. The script below partially works, but only on the last of the three file types, and therefore only echoes one set of results. If I move the final closing parenthesis to the end of the script (from line 17 to line...
by davep
15 Apr 2009 11:06
Forum: DOS Batch Forum
Topic: Drag and Drop Folders to Create Array & Execute Commands
Replies: 4
Views: 7616

for %%a in (%*) do ( echo Processing %%a . . . call :process %%a ) echo All finished pause exit goto :eof I should have known it would be that simple! I was unaware that (%*) was a possibility. It all makes perfect sense now. I updated my batch with your changes and it worked flawlessly. It's two d...