PC Review


Reply
Thread Tools Rate Thread

Calling a batch file from context menu

 
 
ShadowTek
Guest
Posts: n/a
 
      15th Jun 2008
I would like to create an entry in the context menu that will pass a
file of any type or a group of files of any type along to a batch
file. I don't really know that much about editing the registry, but I
am guessing that I have to create something in "HKEY_CLASSES_ROOT\*
\shellex\ContextMenuHandlers", and make it reference the batch file in
some way.
 
Reply With Quote
 
 
 
 
Newbie Coder
Guest
Posts: n/a
 
      15th Jun 2008
ShadowTek,

Take a look at:

http://windowsxp.mvps.org/context_folders.htm

If you open Google & type "Context Menu Handlers" (with quotes) you will
find your answer

--
Newbie Coder
(It's just a name)

"ShadowTek" <(E-Mail Removed)> wrote in message
news:1ff26321-d23c-48c1-b3e9-(E-Mail Removed)...
>I would like to create an entry in the context menu that will pass a
> file of any type or a group of files of any type along to a batch
> file. I don't really know that much about editing the registry, but I
> am guessing that I have to create something in "HKEY_CLASSES_ROOT\*
> \shellex\ContextMenuHandlers", and make it reference the batch file in
> some way.



 
Reply With Quote
 
ShadowTek
Guest
Posts: n/a
 
      26th Jun 2008
> Take a look at:
>
> http://windowsxp.mvps.org/context_folders.htm


That helped to explain what is responsible for what. Thanks.

I did manage to develop a simple, working system that will pass along
the names of all selected files to a batch file. The only thing that
that I didn't bother to build in to it was either a safety check that
limits the batch file to only 1 active instance, or a method of using
more a different temp file for each simultaneous batch file instance.
But I am the only person that will be using this, so I won't bother
with it for now.


======= Start Contents of Registry Entry =======

Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\AllFilesystemObjects\shell]

[HKEY_CLASSES_ROOT\AllFilesystemObjects\shell\Custom Context Menu
Item]
@=""

[HKEY_CLASSES_ROOT\AllFilesystemObjects\shell\Custom Context Menu Item
\Command]
@="C:\\Windows\\system32\\cmd.exe /k call \"C:\\Program Files\\+ Batch
Files +\\01\\New.bat\" \"%1\""

======= End of Registry Entry ============


====== Start Contents of New.bat ===========
set Temptxt="C:\Program Files\+ Batch Files +\01\temp.txt"
if exist %Temptxt% (
echo %1 >> %Temptxt%
exit
) else (
echo %1 > %Temptxt%
ping 127.0.0.1 -n 2
call :CheckTempFileSize
call :ProcessFileList %Temptxt%
del %Temptxt%
set Temptxt=
)
goto :eof

:CheckTempFileSize
call :SetTempFileSizea %Temptxt%
ping 127.0.0.1 -n 2
call :SetTempFileSizeb %Temptxt%
if %TempFileSizea%==%TempFileSizeb% (
set TempFileSizea=
set TempFileSizeb=
goto :eof
) else (
call :CheckTempFileSize
goto :eof
)

:SetTempFileSizea
set TempFileSizea=%~z1
goto :eof

:SetTempFileSizeb
set TempFileSizeb=%~z1
goto :eof

:ProcessFileList
cd "%~dp1"
for /f "tokens=*" %%G in (%~nx1) do (
set WorkingFile=%%G
call :Actions01 %%G
)
goto :eof

:Actions01
// Do stuff with %1

====== End of New.bat ===========
 
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
calling multiple batch files from within a batch file yawnmoth Windows XP General 3 26th May 2008 06:47 PM
Context menu batch rename Steve H Freeware 4 26th May 2006 11:31 PM
Calling a batch file in a Web Service using Process object, uses wrong user context. Bucky Pollard Microsoft C# .NET 1 27th Sep 2005 05:29 PM
Calling a batch file in context menu with _multiple_ parameters files Vinzz Windows XP Help 1 20th Sep 2005 10:49 PM
Short filenames sent to batch file through context menu Yan Bilik Windows XP General 3 25th Jun 2004 03:06 PM


Features
 

Advertising
 

Newsgroups
 


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