![]() |
中国DOS联盟-- 联合DOS 推动DOS 发展DOS --联盟域名:www.cn-dos.net 论坛域名:www.cn-dos.net/forum |
| 游客 | 登录 | 注册 | 会员 | 搜索 | 中国DOS联盟 |
|
中国DOS联盟论坛 现在时间是 2026-08-02 16:47 |
共 48,038 主题排行 / 350,123 发帖 / 今日 1 篇 / 48,251 会员排行 |
| DOS批处理 & 脚本技术(批处理室) » 请教:批处理所建快捷键不能使用相对路径问题。 |
| 可打印版本 1,094 / 2 |
| 第1楼 lianjiang2004 | 发表于 2006-12-16 01:32 |
| 金牌会员 发帖 1,884 积分 3,946 | |
|
请教:批处理所建快捷键不能使用相对路径问题。 请教:批处理所建快捷键不能使用相对路径问题。
任务:用批处理1.bat把另一批处理2.bat拷贝到指定路径,并在桌面建立2.bat的快捷键。 问题是,由于2.bat里有执行相对路径的命令,执行时提示找不到。 请教:这个问题如何解决? 下面是我使用的工具和相关部分代码。 1,建立快捷键工具:Shortcut.exe 2,代码: ------------- 1.bat rem 在桌面创建快捷键 tools\shortcut.exe /f:"%userprofile%"\桌面\2.lnk /a:c /t:\boot\grub\greenghost\2.bat >nul rem 拷贝文件到c:\boot\grub\greenghost md c:\boot\grub\greenghost >nul md c:\boot\grub\greenghost\tools >nul copy *.* c:\boot\grub\greenghost /y >nul copy tools\*.* c:\boot\grub\greenghost\tools /y >nul -------------- 2.bat rem 运行ghost32.exe -dd tools\ghost32.exe -dd -dfile=c:\GHSTSTAT.TXT >nul ============= 问题:不能执行ghost32.exe -dd , 改用c:\boot\grub\greenghost\tools\ghost32.exe -dd -dfile=c:\GHSTSTAT.TXT >nul 的话可执行。 请问如何解决建快捷键的问题? |
|
| 第2楼 0401 | 发表于 2006-12-16 02:38 |
| 中级用户 发帖 88 积分 435 | |
|
指定2.bat的起始位置(working directory)就行了
改一下这句 tools\shortcut.exe /f:"%userprofile%"\桌面\2.lnk /a:c /w:\boot\grub\greenghost\tools\ /t:\boot\grub\greenghost\2.bat >nul |
|
| 第3楼 lianjiang2004 | 发表于 2006-12-16 03:24 |
| 金牌会员 发帖 1,884 积分 3,946 | |
|
谢谢,我试试看。
试了, /w:\boot\grub\greenghost\tools\ 和/w:\boot\grub\greenghost\ 都不行,改成 /w:c:\boot\grub\greenghost\ 可以了。这样已经基本可以了。主批处理可以不动了。 [ Last edited by lianjiang2004 on 2006-12-16 at 05:04 AM ] |
|
|
[ 联系联盟系统管理团队 -
中国DOS联盟 -
标准版 ] Sponsored by ifanr Inc | © 2001–2023 |