![]() |
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-11-11 08:23 |
47,815 topics / 349,930 posts / today 0 new / 48,291 members |
| DOS批处理 & 脚本技术(批处理室) » How to get the current drive letter and save it in a text file? |
| Printable Version 7,919 / 18 |
| Floor16 vkill | Posted 2006-11-25 23:44 |
| 金牌会员 Posts 1,744 Credits 4,103 From 甘肃.临泽 | |
|
First heard of it
|
|
| Floor17 ccwan | Posted 2006-11-25 23:50 |
| 金牌会员 Posts 1,160 Credits 2,725 From 河北廊坊 | |
|
Change the Cmd.exe prompt. If used without parameters, prompt resets the command prompt to the default setting, which is the current drive letter followed by the current directory and a greater-than sign (>).
Syntax prompt Parameters text Specifies any text and information to include in the system prompt. /? Displays help at the command prompt. Remarks You can customize the command prompt to display any desired text, including the current directory name, time and date, and the Windows XP version number, etc. The following table lists the character combinations that can be included in the text command-line option instead of (or in addition to) one or more strings. The list includes a brief description of the text or information added to the command prompt for each character combination. Character Description $q = (equal sign) $$ $ (dollar sign) $t Current time $d Current date $p Current drive and path $v Windows XP version number $n Current drive $g > (greater-than sign) $l < (less-than sign) $b | (pipe) $_ Carriage return - line feed $e ANSI escape code (code 27) $h Backspace key (deletes a character written to the prompt command line) $a & (ampersand) $c ( (left parenthesis) $F ) (right parenthesis) $s space When command extensions are enabled (which is the default), the prompt command supports the formatting characters listed in the following table. Character Description $+ Zero or more plus (+) characters, depending on the depth of the pushd directory stack, one character for each level pushed. $m The remote name associated with the current drive letter, or an empty string if the current drive is not a network drive. If the $p character is included in the text parameter, the system reads the disk after each command is entered to determine the current drive and path. This takes extra time, especially for floppy drives. Examples The following example sets the command prompt to display the current drive and path, followed by a greater-than sign (>): prompt $p$g The following command displays a two-line prompt, with the first line showing the current time and the second line showing the current date: prompt time is:$t$_date is$d [ Last edited by ccwan on 2006-11-25 at 11:52 PM ] |
|
| Floor18 chengbiner | Posted 2006-12-02 09:16 |
| 初级用户 Posts 44 Credits 105 | |
|
Wow... I haven't been here for a few days and there are already so many answers. It seems I'm stupid
|
|
| Floor19 ragingfire | Posted 2010-06-09 13:44 |
| 新手上路 Posts 2 Credits 3 | |
|
set a=%0
echo %a:~0,2%>temp.txt How to borrow reading? |
|
| Prev 1 2 |
|
[ Contact the Union admin team -
中国DOS联盟 -
Standard version ] Sponsored by ifanr Inc | © 2001–2023 |