中国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-12 10:56
47,811 topics / 349,897 posts / today 0 new / 48,256 members
DOS批处理 & 脚本技术(批处理室) » Question about getting the current path under XP
Printable Version  1,113 / 4
Floor1 chujiafu Posted 2010-04-24 00:20
银牌会员 Posts 595 Credits 1,339 From 安徽 宿州
I want to write a batch file that adds a function in the registry to open a file with WinHex from the right-click menu.

The content is as follows:
reg add "HKEY_CLASSES_ROOT\*\shell\WinHex 编辑\command"

/ve /d (the path where Winhex is located)\Winhex.exe "%1"
The batch file and Winhex.exe are in the same folder.

My question is: how can this be done with a batch file?

[ Last edited by chujiafu on 2010-4-24 at 00:21 ]
Floor2 slore Posted 2010-04-24 00:27
铂金会员 Posts 2,478 Credits 5,212
%cd% current working directory

%~dp0 the path where the batch file is located
Floor3 qinchun36 Posted 2010-04-24 00:56
高级用户 Posts 400 Credits 609
This problem bothered me for a long time too. It wasn't until one day when I manually added it in regedit and then exported it as a reg file, observed it, and tried again, that I finally succeeded.

The quotation marks (") have to be handled with the registry escape character, the backslash (\).

Floor4 chujiafu Posted 2010-04-24 07:52
银牌会员 Posts 595 Credits 1,339 From 安徽 宿州
Many thanks to the two posters above, it worked.
Floor5 yonghu111 Posted 2010-04-24 10:17
初级用户 Posts 57 Credits 90
Thanks for sharing
[ Contact the Union admin team - 中国DOS联盟 - Standard version ]
Sponsored by ifanr Inc | © 2001–2023