PDIR question

May 20, 2008
3,515
4
Elkridge, MD, USA
I wanted to use PDIR to create a batch file to rebuild the junctions on my
volume. A command like this would do the job if I could force quotation
marks surrounding @junction[*] into the output:

pdir/a:j/s/nj/("mklnk" "@junction[*]" fpnq) c:\ > rebuild.btm

The fpnq field creates the proper quoting; quoting directory names which do
not need to be quoted is harmless. However, I could not find any syntax that
would generate "@junction[*]", i.e., report the source directory name
enclosed in quotation marks. I tried \=, %=q, "", """, `"`, etc., but all I
could get into the output is either unquoted names, or the literal string
"@junction[*]". Some forms resulted in empty output, some in error messages
(unclosed quote). Nothing did the trick. I know I can postprocess the file,
possibly using the new binary mode, but I don't see a reason why I cannot
get quotation marks into the report line.

The command below behaves the strangest way:

*pdir/s/nj/a:j/("mklink /j" fpnq "%=q"""@junction[*]") %jps

The first junction is reported correctly, with the source directory name
quoted, but subsequent lines revert to @junction[*] instead.
--
Steve
 

samintz

Scott Mintz
May 20, 2008
1,511
18
Solon, OH, USA
Steve,

Have you tried using FOR with an embedded command?

e.g.

for /F "delims=, tokens=1*" %d in ('pdir /s /nj /a:j
/(fpnq","@junction[*]) c:\') do echo mklnk "%d" "%e"

-Scott


Steve F$BaC(Bi$BaO(B <> wrote on 04/15/2009 03:01:09 AM:


> I wanted to use PDIR to create a batch file to rebuild the junctions on
my

> volume. A command like this would do the job if I could force quotation
> marks surrounding @junction[*] into the output:
>
> pdir/a:j/s/nj/("mklnk" "@junction[*]" fpnq) c:\ > rebuild.btm
>
> The fpnq field creates the proper quoting; quoting directory names which
do

> not need to be quoted is harmless. However, I could not find any syntax
that

> would generate "@junction[*]", i.e., report the source directory name
> enclosed in quotation marks. I tried \=, %=q, "", """, `"`, etc., but
all I

> could get into the output is either unquoted names, or the literal
string

> "@junction[*]". Some forms resulted in empty output, some in error
messages

> (unclosed quote). Nothing did the trick. I know I can postprocess the
file,

> possibly using the new binary mode, but I don't see a reason why I
cannot

> get quotation marks into the report line.
>
> The command below behaves the strangest way:
>
> *pdir/s/nj/a:j/("mklink /j" fpnq "%=q"""@junction[*]") %jps
>
> The first junction is reported correctly, with the source directory name


> quoted, but subsequent lines revert to @junction[*] instead.
> --
> Steve
>
>
>
>
>
>
>
 
May 20, 2008
3,515
4
Elkridge, MD, USA
samintz wrote:
| Have you tried using FOR with an embedded command?
|
| e.g.
|
| for /F "delims=, tokens=1*" %d in ('pdir /s /nj /a:j
| /(fpnq","@junction[*]) c:\') do echo mklnk "%d" "%e"

Thanks for your suggestion, and no, I was looking for a way for PDIR to do
it directly instead of using a hidden second instance of TCC, and I just
found it using the @QUOTE function:

*pdir /s /nj /a:j /("mklnk" @quote[%%@junction[*]] fpnq) c:\ >
rebuild.btm

This does the job perfectly for the subset of cases where the quotation
marks are needed due to the strange conflict between file naming rules and
filename specification rules in NTFS, but not in the general case, where the
quotation marks in the output are desired for other reasons.

Note that if there were junctions which point to other junctions, the
restoration may fail depending on the order, so a more elaborate procedure
is needed for the particular case that triggered my OP.
--
Steve
 
Similar threads
Thread starter Title Forum Replies Date
D PDIR question Support 0
M PDir format question... Support 3
M A simple question related to the "dir" (and "pdir") commands... Support 5
J Maybe Not So Hard Pdir Question Support 1
Phileosophos PDIR to list filenames without extensions? Support 2
vefatica PDIR and streams Support 1
vefatica PDIR with fixed-width unqualified filename? Support 2
W pdir returns diff results between tcc and tcmd - one is an error msg Support 5
thedave pdir /s Support 2
Emilio III pdir /f switch Support 1
D pdir ignores pm Support 2
WadeHatler pdir broken in 19.1 for directories with spaces Support 1
M WAD PDir not working correctly... Support 5
vefatica WAD Nested variable expansion in PDIR's @function[*]? Support 13
mfarah More on pdir's options: /(fq) Support 5
mfarah How to? Getting pdir to display relative paths. Support 2
S PDIR and @LABEL questions Support 4
M How to? PDir on multiple wildcard patterns... Support 2
A pdir function usage Support 3
T How to? dir/pdir - 2nd level down only Support 7
JohnQSmith PDIR and descriptions Support 21
G WAD PDIR @IF bug, @WORD bug Support 8
S WAD PDIR: files with percent sign % in name cause not listing other files in directory Support 9
S WAD PDIR ignores exclusion ranges Support 1
M How to? "PDir" not working the way the I _thought _ the documentation said it does… Support 8
S WAD /Sn mishandled in DIR and PDIR, possibly elsewhere Support 15
S Fixed GPF in PDIR Support 3
S PDIR issue Support 1
M PDir causing Take Command/TCC to crash... Support 6
M A "PDir" issue... Support 16
J pdir /b1 issue Support 20
M Missing PDir option... Support 5
S PDIR fails in 12.10.55 Support 3
J V12 PDIR failure Support 1
S PDIR command causes GPF Support 5
D pdir inconsistency Support 4
S PDIR has trouble processing filenames with embedded percent sign Support 3
P PDIR woes Support 0
gschizas pdir crashes horribly in one specific folder Support 5
S pdir /(fq) not working Support 5
R Colored directory listing bug with pdir. Support 1
nickles Bias in PDIR Support 5
F pdir problem Support 3
D can PDIR list full filepaths of docs in a nested folder? Support 13
Gisle Vanem How to? 4NT "detach" question Support 2
C forum Posting Question... Support 3
C question re: Move Support 3
S How to? Upgrade Question: What supporting documentation is required at time of purchase? Support 2
Peter Murschall Documentation Question to %@PSHELL Support 4
Fross Tab Question Support 6

Similar threads