I have already edited the registry to open a comand prompt here. My question is can the cmd prompt be set to run a command from the registry? I would like to be able to right click in windows explorer and have a selection that would make the cmd prompt execute a command in the current directory. In a nut shell I would like to right click the windows 7 explorer window and click an item in that menu that would make a new sub directory in the current directory. Can this be done. I am not a programmer and don't have much knowledge except in writing easy batch files. Any help would be appreciated as I have been trying to figure this out for two years now. Thanks in advance. Joe
Need help with cmd.exe coding
Collapse
X
-
Evidently I did not ask the question correctly or you did not understand what I am trying to accomplish. I know you can create a new folder by using what is built into windows but you have to type the name of the folder and if you need to create several folders it is time consuming. If I had several choices in the context menu that would create a sub-folder, one named 1024x768 and another one named 800x600 and all I had to do was just click that selection in the context menu and it would create a subfolder it would save me a lot of time. Thanks.Comment
-
If you add a subkey to the registry at\HKEY_CLASSES_R OOT\Folder\shel l\
and then add a subkey under that called command. You can set the command's default value to call a batch file or script. That way, when you right click a folder, you can call that command from the context menu.Comment
-
How would you code the batch file to work in the current directory? I know how to write simple batch files and could write one that would create a new directory but I don't know how to write the code that would make it work in the current directory. Thanks for your help.Comment
-
Rabbit, your way over my head. I know what a variable is but I do not understand pass %1%. If could you write me a simple batch that would create a new sub-directory in the current directory and have it name the new sub directory xxx i would be able to figure out how to change the name of the new directory. I could then create a batch file for each different size of the resized pictures. I think I know how to add them to the context menu. If I thought I could figure it out I wouldn't ask but it is above my ability. If you don't have the time I will understand and thanks for trying to help me with this quest.JoeComment
-
If you pass %1% into the bat. For example, by calling this from the command key in the registry:
Code:C:\test.bat %1%
Code:mkdir "%1%\New Directory"
Comment
-
Rabbit, I tried but had no luck. Here is exactly what I did. I created a batch file named test.bat and placed it in the root directory (C). The batch file contained this one line: mkdir "%1%\1024" .
I then opened regedit and went to HKEY_CLASSES_RO OT\Directory\Ba ckground\shell and created a new key called 1024 . I then created a new key under 1024 and named it command.
I then entered this into that key: C:\test.bat %1% . The context menu shows a selection called 1024 but when I click on it I get this message: This file does not have a program associated with it for performing this action. Please install a program or, if one is already installed, create an association in the default Programs control panel.
I ran just the batch file from the root directory and it created a new sub folder under c called 1024 so the batch file works. I must not be putting the keys in the correct place in the registry or I have left something out but I don't know what it is.
I must not be doing something right but I don't know what it is. Thanks again Rabbit. JoeComment
-
I created a batch file named test.bat with one line of code which is:
mkdir "%1%\1024"
I placed the file test.bat into the root directory (C)
I created a new key in:
HKEY_CLASSES_RO OT\Directory\Ba ckground\shell
and named it 1024.
I then created a new sub-key under 1024 and named it command.
I then entered this into the default value of command:
C:\test.bat %1%
The context menu shows 1024 but when I click on it I get the message:
This file does not have a program associated with it for performing this action. Please install a program or, if one is already installed, create an association in the default Programs control panel.
I hope this clears up what I have done. Sometimes I don't phrase things correctly as I don't know all the correct terminology.
Thanks Rabbit for being so patient with me. I do appreciate your trying to help.Comment
-
You were right, Rabbit. When I reset the bat file association it started working. Thank you so much for all your help. It is people like you that give me hope that the internet will not become completely commercialized and people will continue to help others, not always for compensation but just for the sake of exchanging ideas and knowledge.Comment
Comment