parsing arguments to an action

P

Peter Richards

I have associated two actions called write lock and
write unlock with all files that have the extension *.prt.
This was achieved from my computer, tools, folder options,
file types and adding the actions. The actions are batch
files that set attrib +r and attrib -r to lock and unlock
the selected files. When you right click on only one file
and click on the write lock or write unlock action you
only get one invocation of cmd.exe. When you right click
on several files and click on the wrote lock or write
unlock action you get several invocations of cmd.exe.
My question is how can click on several files, then right
click to perform one of my actions and only produce one
invocation of cmd.exe (that is parse all the mouse
higlighted arguments to one cmd shell only)

Regards Peter
 
J

Jerold Schulman

I have associated two actions called write lock and
write unlock with all files that have the extension *.prt.
This was achieved from my computer, tools, folder options,
file types and adding the actions. The actions are batch
files that set attrib +r and attrib -r to lock and unlock
the selected files. When you right click on only one file
and click on the write lock or write unlock action you
only get one invocation of cmd.exe. When you right click
on several files and click on the wrote lock or write
unlock action you get several invocations of cmd.exe.
My question is how can click on several files, then right
click to perform one of my actions and only produce one
invocation of cmd.exe (that is parse all the mouse
higlighted arguments to one cmd shell only)

Regards Peter


Use tip 3216 in the 'Tips & Tricks' at http://www.jsiinc.com to implement the
Send To X PowerToy.

Select the file and send to Clipboard as name.

Sample PlusR.bat

@echo off
if {%1}=={} @echo Syntax PlusR Filename
:loop
if {%1}=={} goto :EOF
attrib +r "%1"
shift
goto loop

Select the file and send to Clipboard as name.
Open a CMD prompt and type:
PlusR
type a space and right-click to pase the selected file names.




Jerold Schulman
Windows: General MVP
JSI, Inc.
http://www.jsiinc.com
 
M

Mark V

Peter Richards wrote in
I have associated two actions called write lock and
write unlock with all files that have the extension *.prt.
This was achieved from my computer, tools, folder options,
file types and adding the actions. The actions are batch
files that set attrib +r and attrib -r to lock and unlock
the selected files. When you right click on only one file
and click on the write lock or write unlock action you
only get one invocation of cmd.exe. When you right click
on several files and click on the wrote lock or write
unlock action you get several invocations of cmd.exe.
My question is how can click on several files, then right
click to perform one of my actions and only produce one
invocation of cmd.exe (that is parse all the mouse
higlighted arguments to one cmd shell only)

Regards Peter

Just an idea you may want to pursue.
I would make a SendTo target which is a link to a batch file. The
batch file would then hand the attrib command each of the passed
parameters in turn... Not done that here except for an entire
directory tree though. Think SHIFT. Also there is a limit on the
total length of all the passed data. I hear XP handles this better
than W2K.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top