How do I open a .bat file in Windows from the program?
menu to open from the
Right-click does not find the program
I would like to open it using Atom Editor etc.
However, you do not want to change the extension association.(I want it to run in cmd.exe when opened normally)
What should I do?
OS:windows10Home1709
windows-10 batch-file
There is a way to use "send".
In Explorer, open shell:sendto
and create a shortcut for the program.Right-click the .bat file→Send→Select the shortcut you created to open it from the program.
It can be done by sending, but I think right click~send~Atom
is better than right click~Atom
, so I suggest a way to manipulate the registry.
Press Windows+r
to enter regedit
to start the registry editor.
Go to \HKEY_CURRENT_USER\Software\Class\*\
.
The *
and the are aligned with the extensions.
This time I tried to target only .bat
, but I couldn't do anything about it, so I will use *
.
*
If you set it below, all files will be covered, so it will increase to the menu of files other than bat...
Right-click *
and choose New - Key .Rename the new key to shell
.
Furthermore, a key atom
is created under it.The name atom
itself is acceptable.
If you click on the key atom
that you just created, you will find on the right.
Double-click (Regulations) to open a dialog, so enter the menu name in the "Value Data" section.
This time, I will choose Open with Atom
.
*Originally, you can set any menu name, but if you set this setting and start Atom, you will be forced to change the menu name because it is covered with Atom's original setting.
I will create a key called command
under the key atom
that I just created.
Click on the command
and you'll see on the right.
Double-click (Regulations) to open a dialog, so enter the path to the executable in the "Value Data" section.
If the atom executable is located in C:\Users\hoge\AppData\Local\atom\app-1.19.2\atom.exe
,
"C:\Users\hoge\AppData\Local\atom\app-1.19.2\atom.exe""%1"
and so on.
By the way, please note that if you do not enclose it with a double quotation, you may not be able to open it with a path containing half-width spaces.
Right-click the appropriate bat file.
The menu Atom Editor
will increase, and if you select that menu, Atom will start.
As I said at the beginning, I think all the files have added menus, so please make sure that you can open them with the same menu on txt, docx, html, and js.
For your information, if you only need Atom, you can easily add and remove the menu Open with Atom from the Atom setting.
File - Settings opens.
Select System
In Show in file context menu
, right-click all types of files and click
In Show info context menu
, right-click the folder and click
You can add a menu called Open with Atom
.
Who do you like?
In the .bat file, write the program that runs at the command prompt.
So you can run the .bat file at the command prompt.
Specifically, do the following:
·Start the command prompt and drag and drop the .bat file into the command prompt window.
·At the command prompt, type the .bat file name and press the return key (you may need to add a folder name before the .bat file name).Depends on which folder you are in)
[Supplement]
If the .bat file displays a message, it is not a good idea to create a shortcut with Send and click on it because clicking on the shortcut launches a command prompt, runs the .bat file, and ends (disappears from the screen) as soon as it is executed.
© 2024 OneMinuteCode. All rights reserved.