Board logo

标题: 如何设定批处理的工作目录 [打印本页]

作者: kingshui     时间: 2006-12-29 06:18    标题: 如何设定批处理的工作目录

请问一下..
如何在批处理里面设定批处理里命令的工作目录呢?
例如:
我的批处理在J:\DOC下面
但是我运行的时候要他工作的目录是在%systemroot%这个系统变量的目录..
应该怎么设置呢?

如下面的:

del /f /q %SystemRoot%\system32\mshearts.exe
del /f /q %SystemRoot%\system32\freecell.exe
del /f /q %SystemRoot%\system32\winmine.exe
del /f /q %SystemRoot%\system32\spider.exe
del /f /q %SystemRoot%\system32\sol.exe
del /f /q %systemroot%\temp\
rd /s /q "%ALLUSERSPROFILE%\「开始」菜单\程序\游戏"
rd /s /q %TEMP%\
rd /s /q %TMP%\
md %TEMP%
del /f /q %systemroot%\*.log *.txt
del /f /q %systemroot%\Prefetch\
dir /a /b $*>updata.txt
for /f %%j in (updata.dat) do rd /s /q "%%j"
del /f /q updata.txt

[ Last edited by kingshui on 2006-12-29 at 06:21 AM ]
作者: namejm     时间: 2006-12-29 06:20
  用 cd /d 来跳转。
作者: kingshui     时间: 2006-12-29 06:26
thanku