无忧启动论坛

标题: 求路径转换 [打印本页]

作者: baolizhu    时间: 2021-6-29 11:55
标题: 求路径转换
@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为这样不知道怎么写批处理??????????
作者: chishingchan    时间: 2021-6-29 12:05
给我好评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
chishingchan 发表于 2021-6-29 12:05
给我好评5分吧!

哈哈,他把注册表加上去了,你把他读出来了,成接龙游戏了
作者: 江南一根葱    时间: 2021-7-3 11:14
  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
复制代码







欢迎光临 无忧启动论坛 (http://bbs.c3.wuyou.net/) Powered by Discuz! X3.3