中国DOS联盟论坛

China DOS Union

-- Unite DOS · Advance DOS · Grow DOS --
Union site: www.cn-dos.net Forum site: www.cn-dos.net/forum
Guest | Log in | Register | Members | Search | China DOS Union
中国DOS联盟论坛
The time now is 2026-08-04 06:48
48,038 topics / 350,123 posts / today 0 new / 48,251 members
DOS批处理 & 脚本技术(批处理室) » Built-in CHM decompiling function in the system!
Printable Version  831 / 5
Floor1 peterdocter Posted 2007-04-19 02:35
中级用户 Posts 95 Credits 379
@echo off
title "Built-in CHM decompiling function in the system!"
echo "Note: there must not be spaces in the chm file!"
echo "Script written by: PeterDocter"
echo "2007-04-18"
path %windir%;%windir%\system32
echo Decompinling...
for /f "tokens=*" %%I in ("%1") do (
rem short Chm filename
set Chm=%%~nxsI
rem create full directory
set ChmDir=%%~nI
rem full path
set ChmPath=%%~dpI
)
rem switch to target path
cd /d %ChmPath%
if not exist "%chmDir%" md "%chmDir%"
rem HH decompile parameters
HH.EXE -decompile %chmDir% %Chm%
echo All files in the %chmDir%!
pause
exit
I want to add a right-click mouse function, but unfortunately I don't know how to do it. Also, when the chm file contains spaces it gets rather troublesome! Please see if anyone can optimize this code a bit?

[ Last edited by peterdocter on 2007-4-19 at 04:38 AM ]
Floor2 huzixuan Posted 2007-04-19 02:40
高级用户 Posts 219 Credits 537 From 芜湖

For details, see for /?
Floor3 peterdocter Posted 2007-04-19 03:48
中级用户 Posts 95 Credits 379
Many thanks! I've already solved it! At the same time, here's one that can decompile chm directly without using other tools!
@echo off
path %windir%;%windir%\system32
echo Decompinling...
for /f "tokens=*" %%I in ("%1") do (
rem short Chm filename
set Chm=%%~nxsI
rem create full directory
set ChmDir=%%~nI
rem decompile short directory
set ChmDe=%%~nsI
rem full path
set ChmPath=%%~dpI
)
rem switch to target path
cd /d %ChmPath%
if not exist "%chmDir%" md "%chmDir%"
rem HH decompile parameters
HH.EXE -decompile %ChmDe% %Chm%
echo All files in the %chmDir%!
pause
exit
Very strange, I found that many commands only work with short paths!
I want to put it into the right-click mouse function, but I don't know how to do it. Is there any related registry information?
Floor4 estar Posted 2007-04-19 04:24
中级用户 Posts 103 Credits 346
It seems the code from the previous post is a bit too troublesome to write~~
Floor5 peterdocter Posted 2007-04-19 04:27
中级用户 Posts 95 Credits 379
There's still a tiny problem: if there are no spaces in the chm file, it will generate one extra directory!
set ChmDir=%%~nI
set Repace=%ChmDir:空格=为空%
How should the above code be written?
Floor6 zh159 Posted 2007-04-19 05:24
金牌会员 Posts 1,467 Credits 3,687
Only when right-clicking a chm file will the “Decompile CHM” item appear; no need to make another bat file


[ Last edited by zh159 on 2007-4-18 at 04:28 PM ]
[ Contact the Union admin team - 中国DOS联盟 - Standard version ]
Sponsored by ifanr Inc | © 2001–2023