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

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

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

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

Windows 7 Ultimate SP1 (64 bit), Windows XP SP3, Linux Mint 17 MATE (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

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




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 03:11 AM.
Twitter Facebook Google+



Windows 7 Forums

Seven Forums Android App Seven Forums IOS App
  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33