Displaying Seven Character Long Text Files

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
NZIdiot
Posts: 4
Joined: 14 Apr 2009 17:39

Displaying Seven Character Long Text Files

#1 Post by NZIdiot » 07 May 2009 03:17

Hi

I have to write a batch command to display 7 character long text files on the whole C: Drive with the listing output in wide format.

How do i display 7 character long files?

I have used

DIR C:\ /S /W ???????.TXT

but this doesn't work. What do i use?

Thanks in advance.

RElliott63
Expert
Posts: 80
Joined: 04 Feb 2009 10:03

#2 Post by RElliott63 » 07 May 2009 08:50

Something to try ... this implies that you don't care what the extension of the file is.

Code: Select all

@echo off
SETLOCAL ENABLEEXTENSIONS
SETLOCAL ENABLEDELAYEDEXPANSION

CD \
For /F "Delims=" %%F In ('Dir /B/S') Do (
    Set "f=%%~nxF"
    Set "p=%%~pF"
    Set "Dot=!f:~7,1!"
    If /I [!Dot!] equ [.] (
       Echo File is 7 bytes:  !f!
       Echo File is located:  !p!
    )
)

Post Reply