Win11/64: Running Batch File Associated W/ File?

Discussion in 'Software' started by HarryPotter, Dec 25, 2024.

  1. HarryPotter

    HarryPotter MajorGeek

    Hi! I have a problem regarding running batch files associated with a file class in Win11/64's Explorer: Windows asks how to open the file. I have two ways to get around this: 1. I can do what I want with another association that's not a batch file, and 2. open a command window. However, both will take extra time, when otherwise, a single right-click should get what I want. Can I fix the batch file problem?
     
  2. HarryPotter

    HarryPotter MajorGeek

    It was worse than I thought: the .exe option didn't work, either. :( I've been using the command prompt, but it's annoying. :(
     
  3. xrobwx71

    xrobwx71 Private E-2

    When you save the batch file, you have to save as, change the name to xxxxx.bat then click the drop down and choose all files instead of .txt. Right click the file, choose run as administrator. It should work then.
    You should not have to mess with file associations.
     
  4. HarryPotter

    HarryPotter MajorGeek

    The problem's not the batch file. The batch file is associated with a file class, such that when I right-click the file, I get an option to run the batch file and feed it the file, and it will perform the task. The problem is that, when I do that, Windows acts like I'm selecting Open With. I can provide the Registry dump if you want.
     
  5. xrobwx71

    xrobwx71 Private E-2

    Open an elevated command prompt.
    Click Start, type cmd, then CTRL+SHIFT+ENTER
    An elevated prompt should open.

    In this prompt, copy and paste assoc .bat=batfile hit Enter.

    Test it.
     
  6. HarryPotter

    HarryPotter MajorGeek

    Well...the file association in question is not a batch file, nor is the batch file going to be the default action. Again, I can export the Registry entries in question if you want.
     
  7. xrobwx71

    xrobwx71 Private E-2

    Ok, export the registry entries as I'm confused. Sorry, it happens a lot. :)
     
  8. HarryPotter

    HarryPotter MajorGeek

    Here it is:
    ----------------
    Windows Registry Editor Version 5.00
    [HKEY_CLASSES_ROOT\DirMaster]
    @="C64 Disk Image"
    [HKEY_CLASSES_ROOT\DirMaster\DefaultIcon]
    @="C:\\Program Files (x86)\\Style\\DirMaster\\DirMaster.exe,0"
    [HKEY_CLASSES_ROOT\DirMaster\shell]
    [HKEY_CLASSES_ROOT\DirMaster\shell\exom0]
    @="exomize c&64"
    [HKEY_CLASSES_ROOT\DirMaster\shell\exom0\command]
    @="\"D:\\Dev\\exomdia\\exomize c64.bat\" %1"
    [HKEY_CLASSES_ROOT\DirMaster\shell\exom1]
    @="exomize c&128"
    [HKEY_CLASSES_ROOT\DirMaster\shell\exom1\command]
    @="\"D:\\Dev\\exomdia\\exomize c128.bat\" %1"
    [HKEY_CLASSES_ROOT\DirMaster\shell\exom9]
    @="exomize &dialog"
    [HKEY_CLASSES_ROOT\DirMaster\shell\exom9\command]
    @="\"D:\\Dev\\exomdia\\exomdia.exe\" %1"
    [HKEY_CLASSES_ROOT\DirMaster\shell\Extract All Here]
    "Icon"="C:\\Program Files (x86)\\Style\\DirMaster\\DirMaster.exe"
    [HKEY_CLASSES_ROOT\DirMaster\shell\Extract All Here\command]
    @="C:\\Program Files (x86)\\Style\\DirMaster\\DirMaster.exe -e \"%1\""
    [HKEY_CLASSES_ROOT\DirMaster\shell\open]
    [HKEY_CLASSES_ROOT\DirMaster\shell\open\command]
    @="C:\\Program Files (x86)\\Style\\DirMaster\\DirMaster.exe \"%1\""
     
  9. xrobwx71

    xrobwx71 Private E-2

    Tell me again what is your goal?
     
  10. HarryPotter

    HarryPotter MajorGeek

    I want to get the entries for exom0, exom1 and exom9 to work. I'll try the regular open entry to see if it works now.
     
  11. HarryPotter

    HarryPotter MajorGeek

    It works, but the other stuff doesn't.
     
  12. xrobwx71

    xrobwx71 Private E-2

    What are you trying to do and what is not happening?
     
  13. HarryPotter

    HarryPotter MajorGeek

    When I select one of the options I described, it's supposed to run the associated batch file. I get the Open With dialog box.
     
  14. xrobwx71

    xrobwx71 Private E-2

    I would also try this:

    Open an elevated command prompt.
    Click Start, type cmd, then CTRL+SHIFT+ENTER
    An elevated prompt should open.

    In this prompt, copy and paste assoc .cmd=batfile hit Enter.

    Test it.
     
  15. HarryPotter

    HarryPotter MajorGeek

    I'm unaware of that feature. I tried it, and it displayed the argument you gave.
     
  16. xrobwx71

    xrobwx71 Private E-2

    What feature?

    So, you ran the above 2 commands I gave you without errors and do you still get the open with dialogue?
     
  17. HarryPotter

    HarryPotter MajorGeek

    The feature to which I was referring was the one you mentioned about the command prompt. I will try your suggestion again, because I used the wrong extension the last time. BTW, I want others to use this program also without needing your suggestion.
     
  18. HarryPotter

    HarryPotter MajorGeek

    I still get the same message. :(
     
  19. xrobwx71

    xrobwx71 Private E-2

    I re-read your first post. It sounds like a file association issue.

    • Open Settings (Win + I).
    • Go to Apps > Default apps.
    • Scroll down to the bottom and click on Choose default apps by file type.
    • Find the .bat extension in the list, and ensure it’s associated with Command Prompt (you may need to browse for cmd.exe if it’s not set correctly).
     
  20. HarryPotter

    HarryPotter MajorGeek

    The problem is that I don't want these actions to be the default actions. I just want those to be options.
     
  21. HarryPotter

    HarryPotter MajorGeek

    BTW, the .bat files to which I'm referring are to be run with the selected file supplied to them. They are not to be run stand-alone. I'm actually using files with the .prg extension. The default action works, though. BTW, the purpose of these options is to easily compress these files.
     
  22. xrobwx71

    xrobwx71 Private E-2

    Try this:

    https://www.majorgeeks.com/files/details/winaero_tweaker.html

    There are a plethora of tweaks you can implement with this program. Perhaps one of them fits what you are looking for.
     
  23. HarryPotter

    HarryPotter MajorGeek

    I downloaded it. I plan to try it later. BTW, I want others to be able to use the program that created these associations as well without this workaround. I'm using Open Watcom for it, but, as OW seems to offer only the standard WinAPI, it should work on other C compilers. If you want, I have an old version of this program online and can post the program's purpose and URL as well.
     
  24. HarryPotter

    HarryPotter MajorGeek

    I just tried it, but after installing it, my antivirus software quarantined the program. :( I really want this to work, as opening the Command prompt and doing the commands is much harder than just using the mouse, especially when I have to switch directories first.
     
  25. xrobwx71

    xrobwx71 Private E-2

    It's very safe. Definitely not a virus. I use it on over 15 machines at work and at home.
     
  26. HarryPotter

    HarryPotter MajorGeek

    I downloaded the item again and tried it but don't see the option I need. :(
     
  27. xrobwx71

    xrobwx71 Private E-2

    I'm sorry to have wasted your time. I'm not an expert on the registry and don't feel comfortable moving forward.
    Hopefully someone who has the ability will be able to help you.
     

MajorGeeks.Com Menu

Downloads All In One Tweaks \ Android \ Anti-Malware \ Anti-Virus \ Appearance \ Backup \ Browsers \ CD\DVD\Blu-Ray \ Covert Ops \ Drive Utilities \ Drivers \ Graphics \ Internet Tools \ Multimedia \ Networking \ Office Tools \ PC Games \ System Tools \ Mac/Apple/Ipad Downloads

Other News: Top Downloads \ News (Tech) \ Off Base (Other Websites News) \ Way Off Base (Offbeat Stories and Pics)

Social: Facebook \ YouTube \ Twitter \ Tumblr \ Pintrest \ RSS Feeds