[已解决]win11无法运行bat文件,怎么解决

ahaka2月前0

双击运行弹出弹出“打开方式”的对话框,让选择:

试了网上的几种方法都不行
网上有很多类似的帖子,方法大致为:
1. 将bat 文件的格式从UTF-8 改成ASNI
2. 添加环境变量,将c:\Windows\System32 添加到环境变量path 中
3. 修改注册表中.bat 相关属性,将其属性值都改成“未设置”
4. 关联成cmd运行
5. 删除注册表batfile
只能手动打开cmd再拖进去才能运行。太是太麻烦了
-----------------------------------------------------------
按这个可以了:命令行
assoc .bat=batfile
ftype batfile="%1" %*
最新回复 (16)
  • zxxx2月前
    引用2
    保存,导入试试
    Windows Registry Editor Version 5.00
    [HKEY_LOCAL_MACHINE\SOFTWARE\Classes\.bat]
    @="batfile"
    [HKEY_LOCAL_MACHINE\SOFTWARE\Classes\.bat\PersistentHandler]
    @="{5e941d80-bf96-11cd-b579-08002b30bfeb}"
    [HKEY_CLASSES_ROOT\.bat]
    @="batfile"
    [HKEY_CLASSES_ROOT\.bat\PersistentHandler]
    @="{5e941d80-bf96-11cd-b579-08002b30bfeb}"
    [HKEY_LOCAL_MACHINE\SOFTWARE\Classes\batfile]
    @="Windows Batch File"
    "EditFlags"=hex:30,04,00,00
    "FriendlyTypeName"=hex(2):40,00,25,00,53,00,79,00,73,00,74,00,65,00,6d,00,52,\
    00,6f,00,6f,00,74,00,25,00,5c,00,53,00,79,00,73,00,74,00,65,00,6d,00,33,00,\
    32,00,5c,00,61,00,63,00,70,00,70,00,61,00,67,00,65,00,2e,00,64,00,6c,00,6c,\
    00,2c,00,2d,00,36,00,30,00,30,00,32,00,00,00
    [HKEY_LOCAL_MACHINE\SOFTWARE\Classes\batfile\DefaultIcon]
    @=hex(2):25,00,53,00,79,00,73,00,74,00,65,00,6d,00,52,00,6f,00,6f,00,74,00,25,\
    00,5c,00,53,00,79,00,73,00,74,00,65,00,6d,00,33,00,32,00,5c,00,69,00,6d,00,\
    61,00,67,00,65,00,72,00,65,00,73,00,2e,00,64,00,6c,00,6c,00,2c,00,2d,00,36,\
    00,38,00,00,00
    [HKEY_LOCAL_MACHINE\SOFTWARE\Classes\batfile\shell]
    [HKEY_LOCAL_MACHINE\SOFTWARE\Classes\batfile\shell\edit]
    [HKEY_LOCAL_MACHINE\SOFTWARE\Classes\batfile\shell\edit\command]
    @=hex(2):25,00,53,00,79,00,73,00,74,00,65,00,6d,00,52,00,6f,00,6f,00,74,00,25,\
    00,5c,00,53,00,79,00,73,00,74,00,65,00,6d,00,33,00,32,00,5c,00,4e,00,4f,00,\
    54,00,45,00,50,00,41,00,44,00,2e,00,45,00,58,00,45,00,20,00,25,00,31,00,00,\
    00
    [HKEY_LOCAL_MACHINE\SOFTWARE\Classes\batfile\shell\open]
    [HKEY_LOCAL_MACHINE\SOFTWARE\Classes\batfile\shell\open\command]
    @=""%1" %*"
    [HKEY_LOCAL_MACHINE\SOFTWARE\Classes\batfile\shell\print]
    [HKEY_LOCAL_MACHINE\SOFTWARE\Classes\batfile\shell\print\command]
    @=hex(2):25,00,53,00,79,00,73,00,74,00,65,00,6d,00,52,00,6f,00,6f,00,74,00,25,\
    00,5c,00,53,00,79,00,73,00,74,00,65,00,6d,00,33,00,32,00,5c,00,4e,00,4f,00,\
    54,00,45,00,50,00,41,00,44,00,2e,00,45,00,58,00,45,00,20,00,2f,00,70,00,20,\
    00,25,00,31,00,00,00
    [HKEY_LOCAL_MACHINE\SOFTWARE\Classes\batfile\shell\runas]
    "HasLUAShield"=""
    [HKEY_LOCAL_MACHINE\SOFTWARE\Classes\batfile\shell\runas\command]
    @=hex(2):25,00,53,00,79,00,73,00,74,00,65,00,6d,00,52,00,6f,00,6f,00,74,00,25,\
    00,5c,00,53,00,79,00,73,00,74,00,65,00,6d,00,33,00,32,00,5c,00,63,00,6d,00,\
    64,00,2e,00,65,00,78,00,65,00,20,00,2f,00,43,00,20,00,22,00,25,00,31,00,22,\
    00,20,00,25,00,2a,00,00,00
    [HKEY_LOCAL_MACHINE\SOFTWARE\Classes\batfile\shell\runasuser]
    @="@shell32.dll,-50944"
    "Extended"=""
    "SuppressionPolicyEx"="{F211AA05-D4DF-4370-A2A0-9F19C09756A7}"
    [HKEY_LOCAL_MACHINE\SOFTWARE\Classes\batfile\shell\runasuser\command]
    "DelegateExecute"="{ea72d00e-4960-42fa-ba92-7792a7944c1d}"
    [HKEY_LOCAL_MACHINE\SOFTWARE\Classes\batfile\shellex]
    [HKEY_LOCAL_MACHINE\SOFTWARE\Classes\batfile\shellex\-ContextMenuHandlers]
    [HKEY_LOCAL_MACHINE\SOFTWARE\Classes\batfile\shellex\-ContextMenuHandlers\Compatibility]
    @="{1d27f844-3a1f-4410-85ac-14651078412d}"
    [HKEY_LOCAL_MACHINE\SOFTWARE\Classes\batfile\shellex\ContextMenuHandlers]
    @="Compatibility"
    [HKEY_LOCAL_MACHINE\SOFTWARE\Classes\batfile\shellex\ContextMenuHandlers\OpenGLShExt]
    @="{E97DEC16-A50D-49bb-AE24-CF682282E08D}"
    [HKEY_LOCAL_MACHINE\SOFTWARE\Classes\batfile\shellex\DropHandler]
    @="{86C86720-42A0-1069-A2E8-08002B30309D}"
    [HKEY_LOCAL_MACHINE\SOFTWARE\Classes\batfile\shellex\PropertySheetHandlers]
    [HKEY_LOCAL_MACHINE\SOFTWARE\Classes\batfile\shellex\PropertySheetHandlers\ShimLayer Property Page]
    @="{513D916F-2A8E-4F51-AEAB-0CBC76FB1AF8}"
    [HKEY_LOCAL_MACHINE\SOFTWARE\Classes\batfile\shellex\{8895b1c6-b41f-4c1c-a562-0d564250836f}]
    @="{1531d583-8375-4d3f-b5fb-d23bbd169f22}"复制代码
  • 雅丶涵2月前
    引用3
    exe和bat都是注册表注册过的执行文件,你可以把exe的注册表拿来看看
  • qwerttaa2月前
    引用4
    改扩展名pif试试?
    或者搜一下cmd2exe、bat2exe
  • 楼主ahaka2月前
    引用5
    qwerttaa 发表于 2022-6-7 12:13
    改扩展名pif试试?
    或者搜一下cmd2exe、bat2exe
    改拓展名没反应
  • 楼主ahaka2月前
    引用6
    雅丶涵 发表于 2022-6-7 12:11
    exe和bat都是注册表注册过的执行文件,你可以把exe的注册表拿来看看
    不会搞呢。。。
  • adminii2月前
    引用7
    改后缀.com或者.exe试试,注册表动了手脚
  • 重装,简单轻松解决问题
  • 5747220312月前
    引用9
    改成.cmd后缀试试
  • 楼主ahaka2月前
    引用10
    zxxx 发表于 2022-6-7 13:56
    保存,导入试试
    不成功,有提示有部分无法导入
  • zxxx2月前
    引用11
    ahaka 发表于 2022-6-7 15:03
    不成功,有提示有部分无法导入
    没办法了
  • 楼主ahaka2月前
    引用12
    adminii 发表于 2022-6-7 13:46
    改后缀.com或者.exe试试,注册表动了手脚
    不行呢
  • 楼主ahaka2月前
    引用13
    我是坏虫 发表于 2022-6-7 13:48
    重装,简单轻松解决问题
    没必要吧。。
  • 楼主ahaka2月前
    引用14
    zxxx 发表于 2022-6-7 15:05
    没办法了
    还是感谢!!
  • 引用15
    ahaka 发表于 2022-6-7 15:11
    没必要吧。。
    你找到bat文件关联的注册表键值在哪里,我去看看我的你添加修改不就好了
  • zxxx2月前
    引用16
    我是坏虫 发表于 2022-6-7 15:21
    你找到bat文件关联的注册表键值在哪里,我去看看我的你添加修改不就好了 ...
    我吧我的bat相关的导出了
  • 引用17
    zxxx 发表于 2022-6-7 15:24
    我吧我的bat相关的导出了
    那就不管他了
  • 游客
    18
返回