![]() |
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-10 15:59 |
47,811 topics / 349,897 posts / today 0 new / 48,255 members |
| DOS批处理 & 脚本技术(批处理室) » May I ask: How to get the current directory name? (Solved) |
| Printable Version 2,757 / 6 |
| Floor1 huzixuan | Posted 2007-03-15 04:08 |
| 高级用户 Posts 219 Credits 537 From 芜湖 | |
|
Current directory is:
C:\Documents and Settings\Administrator\Desktop\test Double-clicking the batch file needs to get test For example: C:\Documents and Settings\Administrator\Desktop\test1 Double-clicking the batch file needs to get test1 Please everyone actively and enthusiastically answer ;) Thank you all ;) (Here "Japanese people" are not welcome! Hehe) [ Last edited by huzixuan on 2007-3-15 at 06:57 AM ] |
|
| Floor2 fengzi | Posted 2007-03-15 04:10 |
| 中级用户 Posts 152 Credits 315 | |
|
Yoshi
[ Last edited by fengzi on 2007-3-14 at 03:11 PM ] |
|
| Floor3 ccwan | Posted 2007-03-15 05:35 |
| 金牌会员 Posts 1,160 Credits 2,725 From 河北廊坊 | |
|
[ Last edited by ccwan on 2007-3-15 at 07:27 AM ] |
|
| Floor4 zh159 | Posted 2007-03-15 05:37 |
| 金牌会员 Posts 1,467 Credits 3,687 | |
|
```
@echo off call :str "%cd%" pause exit :str echo %~n1 goto :eof ``` [ Last edited by zh159 on 2007-3-14 at 04:38 PM ] |
|
| Floor5 huzixuan | Posted 2007-03-15 07:00 |
| 高级用户 Posts 219 Credits 537 From 芜湖 | |
|
Brother zh159, your use of "call" is quite clever!
|
|
| Floor6 jmz573515 | Posted 2007-03-15 08:26 |
| 银牌会员 Posts 464 Credits 1,212 | |
|
Thanks for the correction from the 7th floor. It has been modified, please test...
[ Last edited by jmz573515 on 2007-3-14 at 10:23 PM ] |
|
| Floor7 xycoordinate | Posted 2007-03-15 10:48 |
| 中级用户 Posts 228 Credits 493 From 安徽 | |
Originally posted by zh159 at 2007-3-14 16:37: Test:
[ Last edited by xycoordinate on 2007-3-15 at 08:19 AM ] |
|
|
[ Contact the Union admin team -
中国DOS联盟 -
Standard version ] Sponsored by ifanr Inc | © 2001–2023 |