PC Review


Reply
Thread Tools Rate Thread

dir without path?

 
 
George Hester
Guest
Posts: n/a
 
      27th Nov 2006
I need to use the dir command to get a listing of files off the CD-ROM. But
I do not what the path in the names of the files. I tried:

dit /s /b > d:\DVDs\DVD1.txt

But this gives the path. Is there some switch that I can use to avoid the
drive letter in the list? thanks.

--

George Hester
_________________________________


 
Reply With Quote
 
 
 
 
Alexander Suhovey
Guest
Posts: n/a
 
      27th Nov 2006
> -----Original Message-----
> From: George Hester [private.php?do=newpm&u=]
> Posted At: Monday, November 27, 2006 5:30 PM
> Posted To: microsoft.public.win2000.cmdprompt.admin
> Conversation: dir without path?
> Subject: dir without path?
>
> I need to use the dir command to get a listing of files off the

CD-ROM. But
> I do not what the path in the names of the files.


George,

Try this:

for /r "e:\" %i in (*.*) do @echo %~nxi

where e:\ is your CD/DVD drive letter. When used in batch scripts,
double percent signs (%%i instead of %i).

--
Alexander Suhovey

 
Reply With Quote
 
Matthias Tacke
Guest
Posts: n/a
 
      27th Nov 2006
Alexander Suhovey schrieb:
> for /r "e:\" %i in (*.*) do @echo %~nxi



Hi Alexander,

that doesn't return the path.


This should do: (doesn't include dir names, ordered by name,ext)

for /f "tokens=*" %A in ('dir /B/A-D/S/ONE G:\*') do @echo/%~pnxA


HTH
Matthias

 
Reply With Quote
 
George Hester
Guest
Posts: n/a
 
      28th Nov 2006
Excellent Alexander. Worked pretty good. I put what you had in a bat file
called name.bat and did this in the folder where I want to place these
listings:

name > BIBLE1.txt.

What I got was the listing just as I asked for and the command itself in the
bat. I should lead the bat off with
@echo off
?

--

George Hester
_________________________________
"Alexander Suhovey" <(E-Mail Removed)> wrote in message
news:00df01c71240$7f1f8ed0$(E-Mail Removed)...
> > -----Original Message-----
> > From: George Hester [private.php?do=newpm&u=]
> > Posted At: Monday, November 27, 2006 5:30 PM
> > Posted To: microsoft.public.win2000.cmdprompt.admin
> > Conversation: dir without path?
> > Subject: dir without path?
> >
> > I need to use the dir command to get a listing of files off the

> CD-ROM. But
> > I do not what the path in the names of the files.

>
> George,
>
> Try this:
>
> for /r "e:\" %i in (*.*) do @echo %~nxi
>
> where e:\ is your CD/DVD drive letter. When used in batch scripts,
> double percent signs (%%i instead of %i).
>
> --
> Alexander Suhovey
>



 
Reply With Quote
 
George Hester
Guest
Posts: n/a
 
      28th Nov 2006
OK here we go. Without a bat file:

D:\DVDs\(for /R "h::\" %i in (*.*) do @echo %~nxi) > BIBLE1.txt

where h: is the CD-ROM drive. Thanks.

--

George Hester
_________________________________
"Alexander Suhovey" <(E-Mail Removed)> wrote in message
news:00df01c71240$7f1f8ed0$(E-Mail Removed)...
> > -----Original Message-----
> > From: George Hester [private.php?do=newpm&u=]
> > Posted At: Monday, November 27, 2006 5:30 PM
> > Posted To: microsoft.public.win2000.cmdprompt.admin
> > Conversation: dir without path?
> > Subject: dir without path?
> >
> > I need to use the dir command to get a listing of files off the

> CD-ROM. But
> > I do not what the path in the names of the files.

>
> George,
>
> Try this:
>
> for /r "e:\" %i in (*.*) do @echo %~nxi
>
> where e:\ is your CD/DVD drive letter. When used in batch scripts,
> double percent signs (%%i instead of %i).
>
> --
> Alexander Suhovey
>



 
Reply With Quote
 
Herb Martin
Guest
Posts: n/a
 
      16th Dec 2006
"George Hester" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> OK here we go. Without a bat file:
>
> D:\DVDs\(for /R "h::\" %i in (*.*) do @echo %~nxi) > BIBLE1.txt
>
> where h: is the CD-ROM drive. Thanks.
>


In a batch file the % used to note for variables (e.g., %a, %i)
must be doubled (e.g., %%a, %%i).

It's a quirk of the command line versus batch file parsing.

--
Herb Martin, MCSE, MVP
Accelerated MCSE
http://www.LearnQuick.Com
[phone number on web site]

> --
>
> George Hester
> _________________________________
> "Alexander Suhovey" <(E-Mail Removed)> wrote in message
> news:00df01c71240$7f1f8ed0$(E-Mail Removed)...
>> > -----Original Message-----
>> > From: George Hester [private.php?do=newpm&u=]
>> > Posted At: Monday, November 27, 2006 5:30 PM
>> > Posted To: microsoft.public.win2000.cmdprompt.admin
>> > Conversation: dir without path?
>> > Subject: dir without path?
>> >
>> > I need to use the dir command to get a listing of files off the

>> CD-ROM. But
>> > I do not what the path in the names of the files.

>>
>> George,
>>
>> Try this:
>>
>> for /r "e:\" %i in (*.*) do @echo %~nxi
>>
>> where e:\ is your CD/DVD drive letter. When used in batch scripts,
>> double percent signs (%%i instead of %i).
>>
>> --
>> Alexander Suhovey
>>

>
>



 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
doskey doesn't work; PATH only sets after first Java compile; then resets to old PATH joe Windows XP Help 4 14th May 2008 02:55 PM
how to judge whether a path is relative path or absolute path thinktwice Microsoft Windows 2000 CMD Promt 20 7th May 2008 11:06 PM
An exception occurred in the OnBeforeInstall event handler of <name> Access to the path <path> is denied. Andrzej Lipski Microsoft Dot NET 0 5th Oct 2007 04:24 PM
set path, change path - path grayed out John Smith Windows XP Help 1 12th Feb 2005 01:56 PM
set path, change path - path grayed out John Smith Windows XP General 1 12th Feb 2005 01:56 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 09:15 PM.