批处理文件读取ini

发布于 2024-09-14 07:26:20 字数 1881 浏览 10 评论 0原文

我正在尝试根据 XP 加载的分区自动编辑 boot.ini。 这是我正在处理的批次的片段。前一分钟还有效,下一分钟就失败了。 它并不总是正确地从 boot.ini 读取 有什么建议吗?

@echo off
find "multi(0)disk(0)rdisk(0)partition(1)\WINDOWS" boot.ini | sort /r | date | find "=" > en#er.bat
echo set value=%%5> enter.bat
call en#er.bat
del en?er.bat > nul
echo Value is %value%


if "%value%" NEQ "multi(0)disk(0)rdisk(0)partition(1)\WINDOWS" goto try2
if "%value%"=="multi(0)disk(0)rdisk(0)partition(1)\WINDOWS" echo multi(0)disk(0)rdisk(0)partition(1)\WINDOWS="- EMERGENCY SPYWARE SCAN MODE" /SAFEBOOT:NETWORK /SOS /BOOTLOG /NOGUIBOOT >>boot.ini
goto NEXT

:try2
find "multi(0)disk(0)rdisk(0)partition(2)\WINDOWS" boot.ini | sort /r | date | find "=" > en#er.bat
echo set value=%%5> enter.bat
call en#er.bat
del en?er.bat > nul
echo Value is %value%


if "%value%" NEQ "multi(0)disk(0)rdisk(0)partition(2)\WINDOWS" goto try3
if "%value%"=="multi(0)disk(0)rdisk(0)partition(2)\WINDOWS" echo multi(0)disk(0)rdisk(0)partition(2)\WINDOWS="- EMERGENCY SPYWARE SCAN MODE" /SAFEBOOT:NETWORK /SOS /BOOTLOG /NOGUIBOOT >>boot.ini
goto Next

:try3
find "multi(0)disk(0)rdisk(0)partition(3)\WINDOWS" boot.ini | sort /r | date | find "=" > en#er.bat
echo set value=%%5> enter.bat
call en#er.bat
del en?er.bat > nul
echo Value is %value%

if "%value%"=="multi(0)disk(0)rdisk(0)partition(3)\WINDOWS" echo echo multi(0)disk(0)rdisk(0)partition(2)\WINDOWS="ECLIPSE COMPUTERS - EMERGENCY SPYWARE SCAN MODE" /SAFEBOOT:NETWORK /SOS /BOOTLOG /NOGUIBOOT >>boot.ini
if "%value%" NEQ "multi(0)disk(0)rdisk(0)partition(3)\WINDOWS" ECHO Please Edit Boot.ini Manually !!!!!
pause
ECHO multi(0)disk(0)rdisk(0)partition(3)\WINDOWS="- EMERGENCY SPYWARE SCAN MODE" /SAFEBOOT:NETWORK /SOS 

/BOOTLOG /NOGUIBOOT >>boot.ini
notepad.exe boot.ini

:NEXT

echo This is me being happy...boot.ini

I am trying to automate editing the boot.ini depending on the partition XP loads from.
This is a snippet of the batch I am working on. One minute it works and the next it fails.
It doesn't always correctly read from the boot.ini Any suggestions ?

@echo off
find "multi(0)disk(0)rdisk(0)partition(1)\WINDOWS" boot.ini | sort /r | date | find "=" > en#er.bat
echo set value=%%5> enter.bat
call en#er.bat
del en?er.bat > nul
echo Value is %value%


if "%value%" NEQ "multi(0)disk(0)rdisk(0)partition(1)\WINDOWS" goto try2
if "%value%"=="multi(0)disk(0)rdisk(0)partition(1)\WINDOWS" echo multi(0)disk(0)rdisk(0)partition(1)\WINDOWS="- EMERGENCY SPYWARE SCAN MODE" /SAFEBOOT:NETWORK /SOS /BOOTLOG /NOGUIBOOT >>boot.ini
goto NEXT

:try2
find "multi(0)disk(0)rdisk(0)partition(2)\WINDOWS" boot.ini | sort /r | date | find "=" > en#er.bat
echo set value=%%5> enter.bat
call en#er.bat
del en?er.bat > nul
echo Value is %value%


if "%value%" NEQ "multi(0)disk(0)rdisk(0)partition(2)\WINDOWS" goto try3
if "%value%"=="multi(0)disk(0)rdisk(0)partition(2)\WINDOWS" echo multi(0)disk(0)rdisk(0)partition(2)\WINDOWS="- EMERGENCY SPYWARE SCAN MODE" /SAFEBOOT:NETWORK /SOS /BOOTLOG /NOGUIBOOT >>boot.ini
goto Next

:try3
find "multi(0)disk(0)rdisk(0)partition(3)\WINDOWS" boot.ini | sort /r | date | find "=" > en#er.bat
echo set value=%%5> enter.bat
call en#er.bat
del en?er.bat > nul
echo Value is %value%

if "%value%"=="multi(0)disk(0)rdisk(0)partition(3)\WINDOWS" echo echo multi(0)disk(0)rdisk(0)partition(2)\WINDOWS="ECLIPSE COMPUTERS - EMERGENCY SPYWARE SCAN MODE" /SAFEBOOT:NETWORK /SOS /BOOTLOG /NOGUIBOOT >>boot.ini
if "%value%" NEQ "multi(0)disk(0)rdisk(0)partition(3)\WINDOWS" ECHO Please Edit Boot.ini Manually !!!!!
pause
ECHO multi(0)disk(0)rdisk(0)partition(3)\WINDOWS="- EMERGENCY SPYWARE SCAN MODE" /SAFEBOOT:NETWORK /SOS 

/BOOTLOG /NOGUIBOOT >>boot.ini
notepad.exe boot.ini

:NEXT

echo This is me being happy...boot.ini

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文