It is currently Thu Jun 07, 2018 6:18 pm

All times are UTC - 8 hours [ DST ]




Post new topic This topic is locked, you cannot edit posts or make further replies.  [ 21 posts ] 
Author Message
PostPosted: Thu Jan 10, 2013 9:19 am 
Offline
User avatar

Joined: Thu Jan 03, 2013 12:38 am
Posts: 5341
Note: 'Pin to Start Menu' is already built-in for Classic Shell 4.0 and later to pin EXE files and shortcuts. You do not really need to add this registry tweak for those versions for every day pinning of programs and shortcuts. However, this can be useful for users who are still using Classic Shell 3.6.x or earlier, or also for those users who want some extra pinning abilities to other folders besides the Start Menu folder. If you added Pin To Start Menu previously using this registry tweak, see the last post in this thread on how to remove it.


Short version:
1. Download PinToCSM.zip attached to this post
2. Copy both shellexecute.exe and makelink.exe to your Windows directory which is typically C:\Windows.
3. Double click the reg file to merge it.

You will get a nice "Pin to Classic Start Menu" item in right click menu with a nice icon. It works for multiple files at once as well and you can pin ANYthing - folders and any file by right clicking it.

To uninstall/remove this tweak, copy-paste the contents of the last post into a text file, save as .REG and merge that, then delete the makelink.exe and shellexecute.exe files.

Long version:

Classic Start Menu before 4.0 didn't support pinning from context menu. It was then that I wrote this tutorial to add pinning ability via the context menu. Classic Shell 4.0 added right click pinning feature for all .EXE files and .LNK files (shortcuts). Unfortunately, it works only for 1 file at a time and it doesn't work for folders or other file types. So this tutorial is still useful for those who want to pin many files at once or pin folders using right click.

We can of course drag and drop ANY item - whether it's a folder, file, or URL to the Start Menu folder area or directly paste them in %appdata%\Microsoft\Windows\Start Menu or %ProgramData%\Microsoft\Windows\Start Menu. However, this is not as convenient as pinning. Since pinning is the same thing as 1-click shortcut creation, I used a few free tools and a registry tweak to add "pinning" functionality:

1. Download PinToCSM.zip attached to this post and extract it somewhere. It contains makelink.exe, a freeware command line tool (whose website at http://kerys.co.uk unfortunately went down but you will see by doing makelinkexe /? that it's freeware). And a reg file needed to add the command to the context menu.

2. Because it is a command line tool, when we pin it, it will show a console window. We don't want to view the console window every time we pin. So the ZIP file also includes ShellExecute.exe, which is a wrapper for the ShellExecute API (the built-in Windows API to run anything). It can run makelink.exe as a hidden command, so the console window is not shown.

3. Copy both shellexecute.exe and makelink.exe to your Windows directory which is typically C:\Windows. This step is only needed to add these 2 EXEs to the system path. (If you don't want to copy these to the Windows directory, you will need to edit the reg file to point the EXEs to the path where you put them, otherwise just copying them to %windir% is enough). Now double click the reg file.


That's all. Now you will get a nice "Pin to Classic Start Menu" item in your context menu for everything as the image shows. It works at a time on multiple files too, so pin away. The blue pin icon is loaded from imageres.dll on Windows 7 and Windows 8 (Vista users may need to adjust the icon in the reg file).

Let me know if it works for you.

Also, the makelink.exe tool is a very powerful tool. You can run makelink.exe /? to see the full CLIDL values for various folders and various other parameters. You can optionally edit the REG file to make it pin to another folder instead of the Start Menu folder, for example, the All Programs folder if you change the number after 'CSIDL:' in the reg file to 2 (which means All Programs).


Attachments:
Pin.png
Pin.png [ 6.56 KiB | Viewed 22956 times ]
PinToCSM.zip [70.04 KiB]
Downloaded 1218 times

_________________
Links to some general topics:

Compare Start Menus

Read the Search box usage guide.

I am a Windows enthusiast and did Classic Shell's testing and usability/UX feedback.
Top
 Profile  
 
PostPosted: Thu Feb 28, 2013 2:47 am 
Offline
User avatar

Joined: Thu Feb 21, 2013 11:04 pm
Posts: 463
I have a Question

How can I use ShellExecute.exe to hide the command window from showing when i run normal Bat files? can it be used for that?

i Tried creating a new bat file with the following command: ShellExecute.exe /f:L:\Tenzen's Bat Files\5 Minute Shutdown.bat, but that didnt work

I already have ShellExecute in C:\Windows, does it need to be in the System32 folder for this to work?

i'd like to start the automatic Timed Shutdown from my bat files without showing the Command Windows opening

the batfile contains the following command: c:\windows\system32\shutdown -s -t 300

do you think a new bat file with this command would work?: ShellExecute.exe /f:c:\windows\system32\shutdown -s -t 300

thanks


Top
 Profile  
 
PostPosted: Thu Feb 28, 2013 4:41 am 
Offline
User avatar

Joined: Thu Jan 03, 2013 12:38 am
Posts: 5341
That ShellExecute wrapper has a switch: /R:Hidden and /P switch for parameters to pass to the program you call.

You could also use a VBScript to run anything hidden:

Dim WSHShell
Set WSHShell=WScript.CreateObject("WScript.Shell")
WSHShell.Run "C:\Windows\Notepad.exe", 0

Paste it in Notepad and save as .vbs. Substitute by path to your BAT file.

_________________
Links to some general topics:

Compare Start Menus

Read the Search box usage guide.

I am a Windows enthusiast and did Classic Shell's testing and usability/UX feedback.


Top
 Profile  
 
PostPosted: Thu Feb 28, 2013 8:58 am 
Offline
User avatar

Joined: Thu Feb 21, 2013 11:04 pm
Posts: 463
hmm, well, i tried this:

Dim WSHShell
Set WSHShell=WScript.CreateObject("WScript.Shell")
WSHShell.Run "L:\Tenzen'sBat Files\5 Minute Shutdown.bat", 0

but it didnt work

anyway, can you tell me the exact format for the text for a bat file to run: c:\windows\system32\shutdown -s -t 300

so its not as simple as simply putting shellexecute.exe in front of it I guess, with switches? which switches and how should it all be written?

thanks for ur help


Top
 Profile  
 
PostPosted: Thu Feb 28, 2013 10:15 am 
Offline
User avatar

Joined: Thu Jan 03, 2013 12:38 am
Posts: 5341
Because your path is a long path with spaces, use like this (3 double quotes): Also inside the bat file, use quotes and full path if needed.

Dim WSHShell
Set WSHShell=WScript.CreateObject("WScript.Shell")
WSHShell.Run """L:\Tenzen'sBat Files\5 Minute Shutdown.bat""", 0

This is simpler than shellexecute and doesn't require any 3rd party utilities.

_________________
Links to some general topics:

Compare Start Menus

Read the Search box usage guide.

I am a Windows enthusiast and did Classic Shell's testing and usability/UX feedback.


Top
 Profile  
 
PostPosted: Thu Feb 28, 2013 5:48 pm 
Offline
User avatar

Joined: Thu Feb 21, 2013 11:04 pm
Posts: 463
sweet, works great..

will 3 quotes also work if its a short name without spaces?

and also, do you know way to use the shellexecute.exe in a bat file? if its possible, i think i'd still prefer that method

if one little program can make it so i dont have to remember or deal with all that vbscript syntax, its well worth it to me


Top
 Profile  
 
PostPosted: Thu Feb 28, 2013 10:19 pm 
Offline
User avatar

Joined: Thu Jan 03, 2013 12:38 am
Posts: 5341
If you enter just shellexecute it will show you the syntax. :) /F: <file to run> /P:<parameters to pass> /R:<window state>. So for your shutdown.exe, it should be: shellexecute /F:shutdown.exe /P:-s -t 300 /R:hidden. I haven't tested it.

_________________
Links to some general topics:

Compare Start Menus

Read the Search box usage guide.

I am a Windows enthusiast and did Classic Shell's testing and usability/UX feedback.


Top
 Profile  
 
PostPosted: Fri Mar 01, 2013 6:14 am 
Offline
User avatar

Joined: Thu Feb 21, 2013 11:04 pm
Posts: 463
well, i tried the following:

shellexecute.exe /F:shutdown.exe -s -t 300 /R:hidden
shellexecute.exe /F:shutdown -s -t 300 /R:hidden
shellexecute /F:shutdown.exe -s -t 300 /R:hidden
shellexecute /F:shutdown -s -t 300 /R:hidden
shellexecute.exe /R:hidden /F:shutdown -s -t 300

but couldnt figure it out.. its ok, i dont mind the boxes popping up, it shows me its working anyway

thanks


Top
 Profile  
 
PostPosted: Fri Mar 01, 2013 7:03 am 
Offline
User avatar

Joined: Thu Jan 03, 2013 12:38 am
Posts: 5341
shellexecute /F:shutdown.exe /P:-s -t 300 /R:hidden works perfectly. It can't be that you are not noticing the /P switch even after mentioning it 3 times? :D

_________________
Links to some general topics:

Compare Start Menus

Read the Search box usage guide.

I am a Windows enthusiast and did Classic Shell's testing and usability/UX feedback.


Top
 Profile  
 
PostPosted: Fri Mar 01, 2013 7:19 am 
Offline
User avatar

Joined: Thu Feb 21, 2013 11:04 pm
Posts: 463
i still get a little black box.. it seems its only half the black box, before i think it was 2 black boxes one after another, now maybe its just one..

am i having an extra black box pop up somehow??

and is your shellexecute.exe just in your C:\Windows folder

im in Win7 Ultimate 64-bit

thanks for ur help


Top
 Profile  
 
PostPosted: Fri Mar 01, 2013 11:12 am 
Offline
User avatar

Joined: Thu Jan 03, 2013 12:38 am
Posts: 5341
shellexecute and other executables just need to be in your system path. Are you linking to the batch file? You don't need the batch file at all. Just use the above command as the Start Menu command, just like you would use it from the Run dialog.

_________________
Links to some general topics:

Compare Start Menus

Read the Search box usage guide.

I am a Windows enthusiast and did Classic Shell's testing and usability/UX feedback.


Top
 Profile  
 
PostPosted: Fri Mar 01, 2013 7:36 pm 
Offline
User avatar

Joined: Thu Feb 21, 2013 11:04 pm
Posts: 463
shellexecute /F:shutdown.exe /P:-s -t 300 /R:hidden typed directly into the "Edit Button's" "Command" field worked perfectly!

wow, so Classic Shell's own "Command" box functions exactly like the Windows Command Dialog?.... i wasnt aware of that.. i thought it just recognized some basic commands..

thats a super powerful tool

thanks again, i'll update the tut


Top
 Profile  
 
PostPosted: Wed Apr 10, 2013 7:57 pm 
Offline
User avatar

Joined: Thu Feb 21, 2013 11:04 pm
Posts: 463
Hey, back to ask the master...

any idea if Shell Execute can be used in a script with a relative path?

The Batch File is:
----------------------------------------------------
set drive=%cd:~0,3%
echo %drive%

start "" "%drive%Portable Apps\Start.exe"
----------------------------------------------------
it works great as is.. but a Dos Window pops up, and I'm trying to get rid of that..

Its to be run from a USB Drive on multiple computers where the Drive letter wont be the same from PC to PC

I cant figure out the syntax..

so far I've tried:
----------------------------------------------------
set drive=%cd:~0,3%
echo %drive%

start "" "%drive%Portable Apps\ShellExecute.exe /F:start "" "%drive%Portable Apps\Start.exe" /R:hidden"
--------------------------------------------------------------------------
set drive=%cd:~0,3%
echo %drive%

start "" "%drive%Portable Apps\ShellExecute.exe /F:start "" "%drive%Portable Apps\Start.exe" /R:hidden
----------------------------------------------------------------
set drive=%cd:~0,3%
echo %drive%

start "" "%drive%Portable Apps\ShellExecute.exe /F:start "%drive%Portable Apps\Start.exe" /R:hidden
----------------------------------------------------------------
set drive=%cd:~0,3%
echo %drive%

start "" "%drive%Portable Apps\ShellExecute.exe /F:start %drive%Portable Apps\Start.exe /R:hidden
----------------------------------------------------------------
set drive=%cd:~0,3%
echo %drive%

start "" "%drive%Portable Apps\ShellExecute.exe /F:start "Portable Apps\Start.exe" /R:hidden"
----------------------------------------------------------------
set drive=%cd:~0,3%
echo %drive%

start "" "%drive%Portable Apps\ShellExecute.exe /F:start "Portable Apps\Start.exe" /R:hidden
------------------------------------------------------------------
set drive=%cd:~0,3%
echo %drive%

start "" "%drive%Portable Apps\ShellExecute.exe /F:start Portable Apps\Start.exe /R:hidden
-----------------------------------------------------------------

Anyway, none of those work... I put Shell Execute on the USB Drive in a folder I named "Portable Apps"... then I am trying to make the batch file launch the program "Start.exe" located on the same USB in the same folder

is that possible??

thanks


Top
 Profile  
 
PostPosted: Wed Apr 10, 2013 10:01 pm 
Offline
User avatar

Joined: Thu Jan 03, 2013 12:38 am
Posts: 5341
Nope, relative path won't work. Environment variables may work or adding the folder to the system path.

_________________
Links to some general topics:

Compare Start Menus

Read the Search box usage guide.

I am a Windows enthusiast and did Classic Shell's testing and usability/UX feedback.


Top
 Profile  
 
PostPosted: Thu Apr 11, 2013 3:08 am 
Offline
User avatar

Joined: Thu Feb 21, 2013 11:04 pm
Posts: 463
any idea why not?

do u know why this might not be hiding the dos window:

"J:\My Portable Apps\ShellExecute.exe" /F:"J:\My Portable Apps\Shortcut.bat" /R:Hidden

it runs as if there was no shellexecute /r:hidden at all, popping up a dos window

also tried it as:

"""J:\My Portable Apps\ShellExecute.exe""" /F:"""J:\My Portable Apps\Shortcut.bat""" /R:Hidden

same behavior

also same thing if I go straight to the .exe file, as such:

"J:\My Portable Apps\ShellExecute.exe" /F:"J:\My Portable Apps\Program.exe" /R:Hidden


thanks


Top
 Profile  
 
PostPosted: Thu Apr 11, 2013 3:46 am 
Offline
User avatar

Joined: Thu Jan 03, 2013 12:38 am
Posts: 5341
Try "J:\My Portable Apps\ShellExecute.exe" /F:"cmd /c "J:\My Portable Apps\Shortcut.bat"" /R:Hidden

_________________
Links to some general topics:

Compare Start Menus

Read the Search box usage guide.

I am a Windows enthusiast and did Classic Shell's testing and usability/UX feedback.


Top
 Profile  
 
PostPosted: Thu Apr 11, 2013 3:50 am 
Offline
User avatar

Joined: Thu Feb 21, 2013 11:04 pm
Posts: 463
well, I see its from the fact that its even in a Bat file..

Apparently, Shellexecute's '/r:hidden' cannot be used from batch files, as the window just pops up anyway, because its a batch file..

So, it would seem that in order to run a Shellexecute /r:hidden command from a USB drive, you'd have to have something like a shortcut creator that bundles Icons, AND that accepts dos commands directly, AND that uses relative paths..

anyone know of such a program?

instead of Bat to EXE, maybe something like a CMD to EXE or something

or maybe you'd just have to write your own VB script and bundle it with an Icon in an Exe wrapper...

and all this because Windows doesnt know how to handle Relative Paths..

I can see people leaving to Linux over this issue alone..


Top
 Profile  
 
PostPosted: Thu Apr 11, 2013 3:59 am 
Offline
User avatar

Joined: Thu Feb 21, 2013 11:04 pm
Posts: 463
GauravK wrote:
Try "J:\My Portable Apps\ShellExecute.exe" /F:"cmd /c "J:\My Portable Apps\Shortcut.bat"" /R:Hidden


well, that looks very promising..

I couldnt get it to work, but using cmd would seem to be whats missing

what about something like "cmd /c "J:\My Portable Apps\ShellExecute.exe"" /F:"J:\My Portable Apps\Shortcut.bat" /R:Hidden

that didnt work, but putting cmd at the beginning would maybe allow shell.exe to run in cmd.. anyway, i think it needs to run through cmd somehow.. another program or method perhaps

thanks for the ideas


Top
 Profile  
 
PostPosted: Thu Apr 25, 2013 6:12 am 
Offline
User avatar

Joined: Thu Feb 21, 2013 11:04 pm
Posts: 463
so, if this works:

shellexecute /F:shutdown.exe /P:-s -t 3600 /R:hidden

Why doesnt this work?:

shellexecute /F:shutdown.exe -a /R:hidden

anyway to use shell execute to get: "shutdown -a" (cancel Shutdown) to work hidden?

thanks


Top
 Profile  
 
PostPosted: Thu Apr 25, 2013 6:16 am 
Offline
User avatar

Joined: Thu Feb 21, 2013 11:04 pm
Posts: 463
Fixed it..

shellexecute /F:shutdown.exe /P:-a /R:hidden

makes sense..


Top
 Profile  
 
PostPosted: Mon Jun 17, 2013 6:15 am 
Offline
User avatar

Joined: Thu Jan 03, 2013 12:38 am
Posts: 5341
Btw, to uninstall this context menu tweak, merge this reg (paste into Notepad, save as .REG and merge it). Then, delete makelink.exe and shellexecute.exe if you no longer need them.

Windows Registry Editor Version 5.00

[-HKEY_CURRENT_USER\Software\Classes\*\Shell\PintoClassicStartMenu]

[-HKEY_CURRENT_USER\Software\Classes\AllFileSystemObjects\Shell\PintoClassicStartMenu]

[-HKEY_CURRENT_USER\Software\Classes\Drive\Shell\PintoClassicStartMenu]

[-HKEY_CURRENT_USER\Software\Classes\lnkfile\Shell\PintoClassicStartMenu]

[-HKEY_CURRENT_USER\Software\Classes\InternetShortcut\Shell\PintoClassicStartMenu]

[-HKEY_CURRENT_USER\Software\Classes\Microsoft.Website\Shell\PintoClassicStartMenu]

_________________
Links to some general topics:

Compare Start Menus

Read the Search box usage guide.

I am a Windows enthusiast and did Classic Shell's testing and usability/UX feedback.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic This topic is locked, you cannot edit posts or make further replies.  [ 21 posts ] 

All times are UTC - 8 hours [ DST ]


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group, Almsamim WYSIWYG Classic Shell © 2010-2016, Ivo Beltchev.
All right reserved.