[新手上路]批处理新手入门导读[视频教程]批处理基础视频教程[视频教程]VBS基础视频教程[批处理精品]批处理版照片整理器
[批处理精品]纯批处理备份&还原驱动[批处理精品]CMD命令50条不能说的秘密[在线下载]第三方命令行工具[在线帮助]VBScript / JScript 在线参考
返回列表 发帖

[其他] 请帮忙,批处理更改下面路径为当前文件夹路径




[HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Softimage\CoExistence\D:|software|3D|Softimage 2013 SP1|Application|bin]
"AppDllPath"="D:|software|3D|Softimage 2013 SP1|Application|bin"
"AppName"="SOFTIMAGE Application"
"AppVersion"="11.1.57.0"
"DllPathEnvVar"="SUMATRAPATH"
"SicorePath"="D:|software|3D|Softimage 2013 SP1|Application|bin"
"StormPath"="D:|software|3D|Softimage 2013 SP1|Application|bin"

请教一下为何路径里面都是|而不是\呢?

TOP

本帖最后由 apang 于 2012-11-16 13:57 编辑
  1. @echo off
  2. set "P=%~dp0"
  3. set "P=%P:\=|%"
  4. set "P=%P:~,-1%"
  5. set "V=D:|software|3D|Softimage 2013 SP1|Application|bin"
  6. reg export "HKLM\SOFTWARE\Wow6432Node\Softimage" "%temp%\$"
  7. reg delete "HKLM\SOFTWARE\Wow6432Node\Softimage" /f
  8. (for /f "delims=" %%a in ('type "%temp%\$"') do (
  9.   set "str=%%a"
  10.   setlocal enabledelayedexpansion
  11.   set "str=!str:%V%=%P%!"
  12.   echo,!str!
  13.   endlocal
  14. ))>"%temp%\$.reg"
  15. reg import "%temp%\$.reg"
  16. del "%temp%\$.*"
  17. pause
复制代码
以管理员权限运行,试一下看

TOP

感谢 apang ,有个问题,
每个路径后面多了一个“|”   怎么去掉?

TOP

已修改,试一下

TOP

本帖最后由 000 于 2012-11-19 12:51 编辑

感谢 apang 。

还有2个问题要请教您。
1.批处理导入注册表文件,怎么写?
用下面2种命令都不管用。
reg import "%cd%\regedit64\software.reg"

regedit /s "%cd%\regedit64\software.reg"

2.bat中上上级目录怎么表示?

3.能不能用批处理修改另一个bat文件里的路径?
如下面的文件
  1. set _XSIDIR=C:\Program Files\Autodesk\Softimage 2013 SP1
  2. set _XSIBINDIR=%_XSIDIR%\Application\bin
  3. set _EXITCODE=0
  4. cd /d "%_XSIBINDIR%"
  5. "%_XSIBINDIR%\sireg.exe"  -setcoex "%_XSIBINDIR%\sireg.dll" "%_XSIBINDIR%\sireg.dll"
  6. if ERRORLEVEL 1 set _EXITCODE=1
  7. "%_XSIBINDIR%\sireg.exe"  -setcoex "%_XSIBINDIR%\sireg.dll" "%_XSIBINDIR%\dotxsi.dll"
  8. if ERRORLEVEL 1 set _EXITCODE=1
  9. "%_XSIBINDIR%\sireg.exe"  -setcoex "%_XSIBINDIR%\sireg.dll" "%_XSIBINDIR%\suminfo.dll"
  10. if ERRORLEVEL 1 set _EXITCODE=1
  11. "%_XSIBINDIR%\sireg.exe"  -setval "%_XSIBINDIR%\sireg.dll" "Root Locations\InstallRoot" reg_sz "%_XSIDIR%"
  12. if ERRORLEVEL 1 set _EXITCODE=1
  13. "%_XSIBINDIR%\sireg.exe"  -setval "%_XSIBINDIR%\sireg.dll" "Hardware\Audio\Cache Path" reg_sz "cache"
  14. if ERRORLEVEL 1 set _EXITCODE=1
  15. "%_XSIBINDIR%\sireg.exe"  -setval "%_XSIBINDIR%\sireg.dll" "Hardware\Audio\SI Audio Hal\Hardware\Wave\Active" reg_dword 1
  16. if ERRORLEVEL 1 set _EXITCODE=1
  17. "%_XSIBINDIR%\sireg.exe"  -setval "%_XSIBINDIR%\sireg.dll" "Interactive Cache\Active" reg_dword 0
  18. if ERRORLEVEL 1 set _EXITCODE=1
  19. "%_XSIBINDIR%\sireg.exe"  -setval "%_XSIBINDIR%\sireg.dll" "HProductInfo\PSS EMail" reg_sz "XSIData@softimage.com"
  20. if ERRORLEVEL 1 set _EXITCODE=1
  21. "%_XSIBINDIR%\sireg.exe"  -setval "%_XSIBINDIR%\sireg.dll" "User Preferences\Run-Time Stats Active\Default Value" reg_dword 1
  22. if ERRORLEVEL 1 set _EXITCODE=1
  23. "%_XSIBINDIR%\sireg.exe"  -setval "%_XSIBINDIR%\suminfo.dll" "Root Locations\ArchivesRoot" reg_sz "%_XSIDIR%\Data\DSArchives"
  24. if ERRORLEVEL 1 set _EXITCODE=1
  25. "%_XSIBINDIR%\sireg.exe"  -setval "%_XSIBINDIR%\suminfo.dll" "Root Locations\CommonRoot" reg_sz "%_XSIDIR%\Data\DSPresets"
  26. if ERRORLEVEL 1 set _EXITCODE=1
  27. "%_XSIBINDIR%\sireg.exe"  -setval "%_XSIBINDIR%\suminfo.dll" "Root Locations\InstallRoot" reg_sz "%_XSIDIR%"
  28. if ERRORLEVEL 1 set _EXITCODE=1
  29. "%_XSIBINDIR%\sireg.exe"  -setval "%_XSIBINDIR%\suminfo.dll" "Root Locations\MainRoot" reg_sz "%_XSIDIR%\Data\XSI_SAMPLES"
  30. if ERRORLEVEL 1 set _EXITCODE=1
  31. "%_XSIBINDIR%\sireg.exe"  -setval "%_XSIBINDIR%\suminfo.dll" "Root Locations\ScriptsRoot" reg_sz "%_XSIDIR%\Application\DSScripts"
  32. if ERRORLEVEL 1 set _EXITCODE=1
  33. "%_XSIBINDIR%\sireg.exe"  -setval "%_XSIBINDIR%\suminfo.dll" "Resources\Path" reg_sz "%_XSIDIR%\Application\rsrc"
  34. if ERRORLEVEL 1 set _EXITCODE=1
  35. "%_XSIBINDIR%\cmdreg.exe" -f "%_XSIBINDIR%\XSICOMDLLs.lst"
  36. if ERRORLEVEL 1 set _EXITCODE=1
  37. "%_XSIBINDIR%\cmdreg.exe" -f "%_XSIDIR%\Application\Plugins\PLUGINSCOMDLLs.lst"
  38. if ERRORLEVEL 1 set _EXITCODE=1
  39. "%_XSIBINDIR%\SIisOS.exe" -vista+
  40. if ERRORLEVEL 1 goto PreVista
  41. netsh advfirewall firewall add rule name="XSI" dir=in action=allow program="%_XSIBINDIR%\XSI.exe" enable=yesgoto Done_netsh
  42. :PreVista
  43. netsh firewall add allowedprogram "%_XSIBINDIR%\XSI.exe" XSI ENABLE
  44. :Done_netsh
  45. if NOT "%_EXITCODE%"=="0" goto Failure
  46. :Success
  47. echo Succeded
  48. goto Done
  49. :Failure
  50. echo Failed
  51. :Done
  52. set _XSIDIR=
  53. set _XSIBINDIR=
  54. exit /B %_EXITCODE%
复制代码

TOP

回复 6# 000

1.reg import 和regedit /s 都可以呀,win7系统要bat右键以管理员权限运行
2.bat中上上级目录怎么表示?
比如目录路径为E:\ABC\DEF\GHI\JKL
for %%a in ("E:\ABC\DEF\GHI\JKL\..\..") do echo,%%~fa
可以得到上上级目录路径
3.能不能用批处理修改另一个bat文件里的路径?
能。。。

TOP

返回列表