![]() |
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-11 08:39 |
47,811 topics / 349,897 posts / today 0 new / 48,256 members |
| DOS批处理 & 脚本技术(批处理室) » Ask the expert to explain the symbols < and the command IF NOT defined! |
| Printable Version 1,558 / 6 |
| Floor1 fbwolf | Posted 2007-09-23 16:05 |
| 初级用户 Posts 22 Credits 56 | |
|
As the title. Hope experts can inform in the way of examples, and I am very grateful!
|
|
| Floor2 knoppix7 | Posted 2007-09-23 18:00 |
| 银牌会员 Posts 634 Credits 1,287 From cmd.exe | |
| Floor3 HAT | Posted 2007-09-23 21:33 |
| 版主 Posts 5,017 Credits 9,023 | |
|
< represents input redirection
IF NOT defined means "if not defined" C:\>set a=1 |
|
| Floor4 ngd | Posted 2007-12-21 12:39 |
| 中级用户 Posts 108 Credits 312 | |
|
Using `if not defined` can delete duplicate lines
for /f "delims=" %%i in (test.txt) do ( if not defined %%i set %%i=A & echo %%i>>test2.txt) |
|
| Floor5 everest79 | Posted 2007-12-22 11:01 |
| 金牌会员 Posts 1,127 Credits 2,564 | |
Originally posted by fbwolf at 2007-9-23 04:05 PM:
|
|
| Floor6 moniuming | Posted 2007-12-26 16:22 |
| 银牌会员 Posts 574 Credits 1,335 From 广西 | |
|
Finally understand some, thank you very much for the 5th floor!
|
|
| Floor7 ooaf | Posted 2009-02-07 20:31 |
| 中级用户 Posts 162 Credits 313 | |
|
Using `if not defined` can delete duplicate lines
for /f "delims=" %%i in (test.txt) do ( if not defined %%i set %%i=A && echo %%i>>test2.txt) In the line `if not defined %%i set %%i=A & echo %%i>>test2.txt)`, the `&` should be `&&`. |
|
|
[ Contact the Union admin team -
中国DOS联盟 -
Standard version ] Sponsored by ifanr Inc | © 2001–2023 |