CHM 文檔解包批處理代碼
更新時(shí)間:2011年01月11日 00:56:50 作者:
這兩天遇到需要修改CHM文檔,上網(wǎng)搜了一大堆的CHM解包和修改軟件,發(fā)現(xiàn)很多軟件還得注冊(cè),我暈想了想,似乎Windows中有個(gè)自帶的命令HH可以用得上,就順手寫了這個(gè)批處理
HH的脾氣是目標(biāo)文件夾路徑不支持帶空格或引號(hào),所以變復(fù)雜了點(diǎn),否則一行命令足矣
其他的代碼沒啥難度,重在實(shí)用
批處理代碼如下:
::主命令格式如下
::hh -decompile 目標(biāo)文件夾 CHM源文件名
::目標(biāo)文件夾及文件名均不能加引號(hào),目標(biāo)文件夾不能含空格
@echo off & setlocal enabledelayedexpansion
title CHM 文檔解包批處理 By SunTB
if exist "%~dpnx1" (
set file=%~dpnx1
set file_pth=%~dp1
set file_pth=!file_pth:~0,-1!
set file_name=%~nx1
) else (
echo.&echo 請(qǐng)輸入 CHM 文件完整路徑:
echo.&set /p file=
set file=!file:"=!
call :pthquery
)
if /i not "!file:~-4!"==".chm" (echo.&echo 該文件類型名不是 .CHM ,按任意鍵退出&pause>nul&exit)
set save_pth=!file_name: =!
cd /d "!file_pth!"
hh -decompile !save_pth:~0,-4!_CHM !file_name!
start "" "!file_pth!\!save_pth:~0,-4!_CHM"
exit
::提取手工輸入路徑中的文件夾路徑及文件名
:pthquery
set /a pthx+=1
if "!file:~-%pthx%,1!"=="\" (
set file_pth=!file:~0,-%pthx%!
set file_name=!file:~-%pthx%!
set file_name=!file_name:~1!
goto :eof
)
goto :pthquery
其他的代碼沒啥難度,重在實(shí)用
批處理代碼如下:
復(fù)制代碼 代碼如下:
::主命令格式如下
::hh -decompile 目標(biāo)文件夾 CHM源文件名
::目標(biāo)文件夾及文件名均不能加引號(hào),目標(biāo)文件夾不能含空格
@echo off & setlocal enabledelayedexpansion
title CHM 文檔解包批處理 By SunTB
if exist "%~dpnx1" (
set file=%~dpnx1
set file_pth=%~dp1
set file_pth=!file_pth:~0,-1!
set file_name=%~nx1
) else (
echo.&echo 請(qǐng)輸入 CHM 文件完整路徑:
echo.&set /p file=
set file=!file:"=!
call :pthquery
)
if /i not "!file:~-4!"==".chm" (echo.&echo 該文件類型名不是 .CHM ,按任意鍵退出&pause>nul&exit)
set save_pth=!file_name: =!
cd /d "!file_pth!"
hh -decompile !save_pth:~0,-4!_CHM !file_name!
start "" "!file_pth!\!save_pth:~0,-4!_CHM"
exit
::提取手工輸入路徑中的文件夾路徑及文件名
:pthquery
set /a pthx+=1
if "!file:~-%pthx%,1!"=="\" (
set file_pth=!file:~0,-%pthx%!
set file_name=!file:~-%pthx%!
set file_name=!file_name:~1!
goto :eof
)
goto :pthquery
相關(guān)文章
批處理完美實(shí)現(xiàn)FTP遠(yuǎn)程備份數(shù)據(jù)
本文給大家分享的是實(shí)現(xiàn)使用FTP遠(yuǎn)程備份數(shù)據(jù)到本地的批處理腳本,非常的簡(jiǎn)單實(shí)用,有需要的小伙伴可以參考下。2015-09-09

