The error message 'PathNotFound' suggests that the script is unable to find the specified file path.

One possible reason for this error could be that the file path contains special characters such as spaces or non-ASCII characters. To resolve this issue, you can try enclosing the file path in double quotes.

Here's an updated version of the script that includes double quotes around the file paths:

@echo off
setlocal EnableDelayedExpansion

set "CurrCD=%~dp0"
set "strOld=<?xml version='1.0' encoding='utf-8'?><Key xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'><ProductKey>" 
set "strNew="

for /f %%i in ('dir /b /s /a:-d *.xml') do (
    set "file=%%i"
    setlocal DisableDelayedExpansion
    set "newFile=!file:%strOld%=%strNew%!"
    powershell -Command "(gc '!ile!') -replace '%strOld%', '%strNew%' | Out-File '!
ewFile!'" 
    endlocal
)

pause

Make sure to save the script with a .bat file extension and try running it again.


原文地址: https://www.cveoy.top/t/topic/pldY 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录