无忧启动论坛

 找回密码
 注册
搜索
系统gho:最纯净好用系统下载站投放广告、加入VIP会员,请联系 微信:wuyouceo
查看: 5601|回复: 3
打印 上一主题 下一主题

[求助] 求路径转换

[复制链接]
跳转到指定楼层
1#
发表于 2021-6-29 11:55:03 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
@echo off
Color 0A
pushd %~dp0
cd "%~dp0"
if exist "%LOCALAPPDATA%\Microsoft\Edge SxS\Application\msedge.exe" set edge=%LOCALAPPDATA%\Microsoft\Edge SxS\Application\msedge.exe
if exist "%ProgramFiles(x86)%\Microsoft\Edge Dev\Application\msedge.exe" set edge=%ProgramFiles(x86)%\Microsoft\Edge Dev\Application\msedge.exe
if exist "%ProgramFiles(x86)%\Microsoft\Edge Beta\Application\msedge.exe" set edge=%ProgramFiles(x86)%\Microsoft\Edge Beta\Application\msedge.exe
if exist "%LOCALAPPDATA%\Microsoft\Edge SxS\Application\msedge.exe" set edge=%LOCALAPPDATA%\Microsoft\Edge SxS\Application\msedge.exe
if exist "%ProgramFiles(x86)%\Microsoft\Edge\Application\msedge.exe" set edge=%ProgramFiles(x86)%\Microsoft\Edge\Application\msedge.exe
reg add "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\edge.exe" /ve /t REG_SZ /d "C:\Program Files (x86)\Microsoft\Edge\Application\msedge.exe" /f
reg add "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\edge.exe" /v "Path" /t REG_SZ /d "C:\Program Files (x86)\Microsoft\Edge\Application" /f
我想把%edge%这个变量的文件路径截取C:\Program Files (x86)\Microsoft\Edge\Application为这样不知道怎么写批处理??????????
2#
发表于 2021-6-29 12:05:16 | 只看该作者
给我好评5分吧!
  1. :: 检测安装路径
  2. for /f "tokens=3*" %%a in ('REG QUERY "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\msedge.exe" /v "" ^|findstr "msedge.exe"') do set Default=%%a %%b
复制代码

点评

哈哈,他把注册表加上去了,你把他读出来了,成接龙游戏了  详情 回复 发表于 2021-7-3 11:02
回复

使用道具 举报

3#
发表于 2021-7-3 11:02:39 | 只看该作者

哈哈,他把注册表加上去了,你把他读出来了,成接龙游戏了
回复

使用道具 举报

4#
发表于 2021-7-3 11:14:53 | 只看该作者
  1. echo off
  2. Color 0A
  3. pushd %~dp0
  4. cd "%~dp0"
  5. for %%a in (SxS Dev Beta) do (
  6. set ver= %%a
  7. echo %LOCALAPPDATA%\Microsoft\Edge%ver%\Application\msedge.exe
  8. if exist "%LOCALAPPDATA%\Microsoft\Edge%ver%\Application\msedge.exe" set edge="%LOCALAPPDATA%\Microsoft\Edge%ver%\Application\msedge.exe"&&set edgepath="%LOCALAPPDATA%\Microsoft\Edge%ver%\Application"
  9. if exist "%ProgramFiles(x86)%\Microsoft\Edge%ver%\Application\msedge.exe" set edge="%ProgramFiles(x86)%\Microsoft\Edge%ver%\Application\msedge.exe"&&set edgepath="%LOCALAPPDATA%\Microsoft\Edge%ver%\Application"

  10. )
  11. echo edge执行文件:%edge%
  12. echo edge执行文件所在目录%edgepath%

  13. reg add "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\edge.exe" /ve /t REG_SZ /d %edge% /f
  14. reg add "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\edge.exe" /v "Path" /t REG_SZ /d %edgepath% /f
复制代码


回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

小黑屋|手机版|Archiver|捐助支持|无忧启动 ( 闽ICP备05002490号-1 )

闽公网安备 35020302032614号

GMT+8, 2024-11-25 10:45

Powered by Discuz! X3.3

© 2001-2017 Comsenz Inc.

快速回复 返回顶部 返回列表