Board logo

标题: 批处理里不能使用变量路径? [打印本页]

作者: winsfly    时间: 2011-7-17 20:46     标题: 批处理里不能使用变量路径?

本帖最后由 winsfly 于 2011-7-17 20:48 编辑

我最近做了一个批处理,功能就是在桌面上创建一个指定链接的URL
关键就是我想智能判断桌面在哪并在桌面上创建
代码:
rem 创建桌面网址导航
if exist desktop.txt del desktop.txt
reg query "HKCU\software\microsoft\windows\currentversion\explorer\User Shell Folders" /v Desktop >desktop.txt
for /f "skip=4 tokens=3" %%a in (desktop.txt) do cd /d %%a\
del desktop.txt
if exist 网址导航.url del 网址导航.url
echo [DEFAULT]>>网址导航.url
echo BASEURL=http://www.jj123.com.cn/index.htm?u=4756>>网址导航.url
echo [InternetShortcut]>>网址导航.url
echo URL=http://www.jj123.com.cn/index.htm?u=4756>>网址导航.url
echo IconIndex=41>>网址导航.url
echo IconFile=C:\WINDOWS\system32\shell32.dll>>网址导航.url
我当前的桌面在注册表中是%userprofile%\桌面
我在cmd窗口可以 cd /d %userprofile%\桌面
在批处理里面就不行,发现是因为有个%userprofile%变量

另外求教有没有会做lnk的Internet Explorer快捷方式并指定链接为某个网址?
作者: powerbat    时间: 2011-7-17 20:52

call cd /d %%a\
作者: winsfly    时间: 2011-7-18 00:57

本帖最后由 winsfly 于 2011-7-18 01:00 编辑
call cd /d %%a\
powerbat 发表于 2011-7-17 20:52

call cd /d %%a\
谢谢,有没有会做lnk的批处理呢?
还有就是桌面那个默认的IE图标 用批处理怎么判断其是否存在,如果不存在就建立,
作者: Batcher    时间: 2011-7-18 13:38

3# winsfly


批处理创建快捷方式
http://bbs.bathome.net/thread-11050-1-1.html




欢迎光临 批处理之家 (http://bbs.bathome.net/) Powered by Discuz! 7.2