|
- @echo off
- set route=%cd%
- set ravel=
- set /p ravel= 请输入要转化的批处理:
- set "ravel=%ravel:"=%"
- if exist "%ravel%" goto go
- :go
- for /f "delims=*" %%a in ("%ravel%") do (
- cd /d "%%~dpa"
- set file=%%~na.vbs
- set ffile=%%~nxa
- )
- copy %ffile% bak%ffile%
- for /f "delims=" %%a in ('type %ffile%') do (
- set "str=%%a"
- setlocal enabledelayedexpansion
- echo !str:^"=^"^"!>>temp
- endlocal
- )
- move /y temp %ffile%>nul
- echo set fso = createobject("scripting.filesystemobject")>>temp.vbs
- echo ' 读取文件>>temp.vbs
- echo set stream = fso.opentextfile("%ffile%",1)>>temp.vbs
- echo content = stream.readall()>>temp.vbs
- echo call stream.close()>>temp.vbs
- echo ' 替换字符串>>temp.vbs
- echo content = replace(content,"*","♀")>>temp.vbs
- echo ' 保存文件>>temp.vbs
- echo set stream = fso.opentextfile("%ffile%",2)>>temp.vbs
- echo call stream.write(content)>>temp.vbs
- echo call stream.close()>>temp.vbs
- start /w wscript temp.vbs
- del temp.vbs /q
- echo set fso=createobject("scripting.filesystemobject")>>%File%
- echo set ws=CreateObject("wscript.shell")>>%File%
- echo set fw=fso.createtextfile("1.bat",2)>>%File%
- for /f "delims=*" %%a in ('type %ffile%') do (
- echo fw.writeline("%%a"♂)>>%File%
- echo fw.close>>%File%
- echo ws.run "cmd /c 1.bat",vbhide,True>>%File%
- echo fso.deleteFile "1.bat">>%File%
- )
- move /y bak%ffile% %ffile%
- for /f "delims=" %%a in (%File%) do (
- set "str=%%a"
- setlocal enabledelayedexpansion
- echo !str:♀=*!>>temp
- endlocal
- )
- move /y temp %File%>nul
- for /f "delims=" %%a in (%File%) do (
- set "str=%%a"
- setlocal enabledelayedexpansion
- echo !str:♂=^)!>>temp
- endlocal
- )
- move /y temp %File%>nul
复制代码
bat2vbs.rar
(714 Bytes, 下载次数: 301)
|
评分
-
查看全部评分
|