标题: 求路径转换 [打印本页] 作者: 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分吧!
:: 检测安装路径
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
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"
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"