标题: [文件操作] 批处理怎样将当前目录切换到桌面? [打印本页]
作者: cy32cxb98 时间: 2009-11-28 04:30 标题: 批处理怎样将当前目录切换到桌面?
以下是我写的一段代码,不知有没有无效的情况,请高手指点……
- @echo off&color a&mode con cols=45 lines=15&title 将当前目录切换到桌面
- echo %cd%|find "%SystemDrive%">nul&&cd %userprofile%\桌面
- echo %cd%|find "%SystemDrive%">nul||(%SystemDrive%&cd %userprofile%\桌面)
- echo %cd%
- pause>nul
复制代码
作者: Bluezhao 时间: 2009-11-28 09:26
自己试下不就知道了 我试了下,可以
作者: batman 时间: 2009-11-28 11:26
不要搞得这么复杂,下面两句都可以做到:
cd /d %userprofile%\桌面
pushd %userprofile%\桌面
[ 本帖最后由 batman 于 2009-11-28 11:33 编辑 ]
作者: cy32cxb98 时间: 2009-11-28 23:57
不好意思,cd命令参数没学全,惭愧、惭愧…………
谢谢!
欢迎光临 批处理之家 (http://www.bathome.net/) |
Powered by Discuz! 7.2 |