![]() |
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-04 12:07 |
48,038 topics / 350,123 posts / today 0 new / 48,251 members |
| DOS批处理 & 脚本技术(批处理室) » Can set /p var= have green prompt text, and the entered text be red? |
| Printable Version 1,193 / 7 |
| Floor1 linmilin | Posted 2007-04-15 22:10 |
| 初级用户 Posts 23 Credits 57 | |
|
Can set /p var= make the prompt text green, and the text entered by the user red?
For example: Please enter the date:20070101 |
|
| Floor2 mygoldnet | Posted 2007-04-15 23:04 |
| 初级用户 Posts 32 Credits 90 | |
|
colorx program
|
|
| Floor3 linmilin | Posted 2007-04-16 00:06 |
| 初级用户 Posts 23 Credits 57 | |
|
I tried using the echox enhancement tool, but after “set /p var=” the following command gets output as characters.
|
|
| Floor4 vkill | Posted 2007-04-16 02:14 |
| 金牌会员 Posts 1,744 Credits 4,103 From 甘肃.临泽 | |
|
I couldn't think of a way, because this is waiting for user input here.
|
|
| Floor5 mygoldnet | Posted 2007-04-16 03:01 |
| 初级用户 Posts 32 Credits 90 | |
|
color foreground is red
set /p var=prompt is empty echox prompt text (green) |
|
| Floor6 htysm | Posted 2007-04-16 03:06 |
| 高级用户 Posts 415 Credits 866 | |
|
Without third-party tools, I'm afraid it's hard to do, right?
|
|
| Floor7 bjsh | Posted 2007-04-16 04:00 |
| 银牌会员 Posts 621 Credits 2,000 | |
|
For this kind of thing that's hard to do in batch, it's best to use another language instead.
|
|
| Floor8 hngaoshou | Posted 2007-05-02 21:40 |
| 社区乞丐 Posts 77 Credits -16 | |
|
@echo off
color f2 set/p,=Please enter text: if "%,%"=="" goto end color f4 echo %,% pause>nul |
|
|
[ Contact the Union admin team -
中国DOS联盟 -
Standard version ] Sponsored by ifanr Inc | © 2001–2023 |