PDIR question

#1
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,275
11
Solon, OH, USA
#2
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
>
>
>
>
>
>
>
 
#3
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