Windows 7 Forums

Welcome to Windows 7 Forums. Our forum is dedicated to helping you find support and solutions for any problems regarding your Windows 7 PC be it Dell, HP, Acer, Asus or a custom build. We also provide an extensive Windows 7 tutorial section that covers a wide range of tips and tricks.


Windows 7: Would it be possible to run this from a context menu?

12 Nov 2011   #1
Rizaria

Windows 7 Home Premium
 
 
Would it be possible to run this from a context menu?

I use the following a lot:

Code:
I prefer (especially with images) to have them all in one folder that I can browse. If you do, too, then open up a command prompt by going to Start --> Run... and typing cmd and ENTER. Then, go to the folder that contains the folders you want to merge. If the folders were in C:\Documents and Settings, you would type cd\"Documents and Settings" to get to it. Then type the following. Be sure to include the dot at the end:


Code:
for /r %i in (*.*) do move "%i" .

The command above moves all files stored in all sub-folders folders of the current folder into the current folder. You can also move files of just one type. For .psd files, for example, you would replace the *.* with *.psd. The /r stands for "recurse," meaning it goes through not just the current folder, but sub-folders, as well. The %i is a variable. Finally, the dot at the end is shorthand for the current folder.
And I was wondering if it'd be possible to make it into a context menu thing, how I could right click on a folder and it would automatically take note of the folder/subfolders/files and run that command?

Or something quite like it. I believe I used to have something on Mac that did it actually..The Big Mean Folder Machine.

Long story short, I want the ability to right click on a folder and merge everything within seamlessly. Can anyone point me in the right direction please?


My System SpecsSystem Spec
.
12 Nov 2011   #2
Corazon

Windows 7 Professional SP1 32-bit
 
 

I was intrigued by the idea...and tried to come up with a right-click menu entry to do this. So far, this is what I've got:
Quote:
Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\Directory\shell\merge]
@="Merge this folder with subfolders"

[HKEY_CLASSES_ROOT\Directory\shell\merge\command]
@="cmd.exe /s /c pushd \"%V\" && for /r %i in (*.*) do move /-y \"%i\" ."
Basically, you would copy/paste this into Notepad, save it with a .reg file extension and doubleclick that file to add the entries to your registry.
After that, you'll get a new context menu entry named Merge this folder with subfolders whenever you rightclick a folder in Explorer.

However: the actual command may not work correctly. DO NOT use this in its current form - I tweaked it a few times and was testing it, until I rightclicked a test folder on my storage drive and upon selecting this command, it started moving files in C:\Windows\system32 around. Needless to say, my heart stopped - thank God it only made a minor mess and I could trace all the files and move them back to where they belong.

I expanded the command line to first make the rightclicked folder its active working directory and then execute the for/move command. I'd just rather not test it again after the near-accident I had, but someone with more shell scripting experience than me can hopefully figure out my mistake.

Anyway, it's something to work with.

My System SpecsSystem Spec
13 Nov 2011   #3
Rizaria

Windows 7 Home Premium
 
 

Quote   Quote: Originally Posted by Corazon View Post
I was intrigued by the idea...and tried to come up with a right-click menu entry to do this. So far, this is what I've got:
Quote:
Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\Directory\shell\merge]
@="Merge this folder with subfolders"

[HKEY_CLASSES_ROOT\Directory\shell\merge\command]
@="cmd.exe /s /c pushd \"%V\" && for /r %i in (*.*) do move /-y \"%i\" ."
Basically, you would copy/paste this into Notepad, save it with a .reg file extension and doubleclick that file to add the entries to your registry.
After that, you'll get a new context menu entry named Merge this folder with subfolders whenever you rightclick a folder in Explorer.

However: the actual command may not work correctly. DO NOT use this in its current form - I tweaked it a few times and was testing it, until I rightclicked a test folder on my storage drive and upon selecting this command, it started moving files in C:\Windows\system32 around. Needless to say, my heart stopped - thank God it only made a minor mess and I could trace all the files and move them back to where they belong.

I expanded the command line to first make the rightclicked folder its active working directory and then execute the for/move command. I'd just rather not test it again after the near-accident I had, but someone with more shell scripting experience than me can hopefully figure out my mistake.

Anyway, it's something to work with.


Interesting but yeah...I'll wait for something that won't screw with my System32 files. Windows dies easy enough without that sort of intervention.
My System SpecsSystem Spec
.

13 Nov 2011   #4
lehnerus2000

W7 Ultimate SP1, LM18 MATE, W10IP VM, W10 Home, #All 64 bit
 
 

Couldn't you put that code in a batch file and then create a "context menu" entry (in the "Registry") that points at the batch file?

I'm a bit snowed under at the moment, so I can't give you the specifics.
The "big brains" should be able to tell you how to do this off of the top of their heads.
XP used to have a built in tool for manipulating the "context menu".

Remember to backup up your OS, BEFORE you start messing with the Registry.
My System SpecsSystem Spec
13 Nov 2011   #5
Rizaria

Windows 7 Home Premium
 
 

Quote   Quote: Originally Posted by lehnerus2000 View Post
Couldn't you put that code in a batch file and then create a "context menu" entry (in the "Registry") that points at the batch file?

I'm a bit snowed under at the moment, so I can't give you the specifics.
The "big brains" should be able to tell you how to do this off of the top of their heads.
XP used to have a built in tool for manipulating the "context menu".

Remember to backup up your OS, BEFORE you start messing with the Registry.
I couldn't even make it into a batch file successfully, so, no. Couldn't get the batch file to get the directory where it was running.
My System SpecsSystem Spec
Reply

 Would it be possible to run this from a context menu?




Thread Tools




Similar help and support threads
Thread Forum
New Context Menu - Remove & Restore Default Menu Items
How to Remove and Restore the Default "New" Context Menu Items in Windows 7 and Windows 8 This will show you how to either remove or restore the default New context menu items in Windows 7 and Windows 8. These include the NEW - Folder, Shortcut, Bitmap image, Contact, Journal Document, Rich...
Tutorials
Context Menu - Create Cascading Menu of Multiple Layers
How to Create a Desktop Cascading Context Menu of Multiple Layers in Windows This tutorial will help show you how to build your own cascading context menu on the desktop in Windows 7 and Windows 8. Therefore, stop reading and make yourself a list of 12 programs that can be divided into...
Tutorials
How do I move context menu items into a cascading context menu?
Okay, I'm not sure if this can be done as easily as I'm hoping. What I'm wanting to do is move already existing context menu items into a cascading context menu to organize and reduce clutter. For instance, I would have a cascading menu named "Scan with" and inside it would be avast! Internet...
Customization
Why is the context menu in Start Menu and Taskbar so small?
http://i.imgur.com/VbR4O.png I know that the full version can be achieved while holding the shift key, but is there way to bypass that and have the regular full sized menu by default?
General Discussion
Unable to remove MagicISO context menu from right click menu in Win 7
Hey it's been a while since I've last been here, I really enjoy this Win 7 community hope everyone is doing well. Anyway let me cut to the chase, basically I want to be able to remove the MagicISO context menu from the right click context menu in Windows 7. See pics to understand what I'm...
Customization
Custom Items on Start Menu Context Menu
We have a custom application which users are used to launching by right clicking on the start menu and selecting it from there. We have made this customisation in both XP and Vista by adding an entry in: HKEY_CLASSES_ROOT\Folder\shell However when I try to do this in Windows 7 nothing...
Customization


Our Sites

Site Links

About Us

Find Us

Windows 7 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 7" and related materials are trademarks of Microsoft Corp.

Designer Media Ltd

All times are GMT -5. The time now is 19:05.

Twitter Facebook Google+



Windows 7 Forums

Seven Forums Android App Seven Forums IOS App