标题: [注册表类] (已解决)请教批处理当前路径双斜杠的问题 [打印本页]
作者: maghreb 时间: 2019-5-2 21:36 标题: (已解决)请教批处理当前路径双斜杠的问题
本帖最后由 maghreb 于 2020-11-15 17:21 编辑
比如我有一个文本1.TXT,内容如下:
Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SOFTWARE\xyz\abc\Applications]
"LOADER1"="C:\\Program Files\\abc 2018\\def.dll"
"LOADER2"="C:\\Program Files\\abc 2019\\ghi.dll"
请教大神们,修改该文本中(注意是修改文本1.TXT)注册表位置C:\\Program Files为当前任意目录,而且是双斜杠
作者: hfstar 时间: 2019-5-2 23:18
reg add "HKLM\SOFTWARE\xyz\abc\Applications" /v "LOADER1" /d "C:\Program Files\abc 2018\def.dll" /f
reg add "HKLM\SOFTWARE\xyz\abc\Applications" /v "LOADER2" /d "C:\Program Files\abc 2019\ghi.dll" /f
作者: Batcher 时间: 2019-5-4 07:21
- @echo off
- setlocal enabledelayedexpansion
- set "prefix=%~dp0"
- set "prefix=!prefix:\=\\!"
- (for /f tokens^=1*^ delims^=^" %%a in ('type "1.txt"') do (
- if "x%%b" neq "x" (
- set "suffix=%%b"
- set "suffix=!suffix:~-18!"
- echo "%%a"="!prefix!!suffix!
- ) else (
- echo %%a
- )
- ))>"2.txt"
复制代码
欢迎光临 批处理之家 (http://www.bathome.net/) |
Powered by Discuz! 7.2 |