![]() |
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-02 20:29 |
48,038 topics / 350,123 posts / today 1 new / 48,251 members |
| DOS批处理 & 脚本技术(批处理室) » How to display computer names that meet the requirements without duplicates? |
| Printable Version 856 / 14 |
| Floor1 noop | Posted 2006-12-23 11:06 |
| 初级用户 Posts 8 Credits 20 | |
|
There are 200 machines. How can I do this:
After determining that the file c:\xx.exe does not exist, display that computer name into the file d:\a.txt and the computer names must not be duplicated!! How should the batch file be written? The requirement is to keep the computer names that meet the condition~ |
|
| Floor2 fjcyz | Posted 2006-12-23 12:08 |
| 初级用户 Posts 36 Credits 68 | |
| Floor3 scriptor | Posted 2006-12-23 12:14 |
| 银牌会员 Posts 555 Credits 1,187 | |
| Floor4 noop | Posted 2006-12-23 12:16 |
| 初级用户 Posts 8 Credits 20 | |
|
If you write it like that, then a.txt can only keep 1 computer name!!!!!!!!!!!!!!!!
I need to save all computer names that meet the condition~ |
|
| Floor5 noop | Posted 2006-12-23 12:17 |
| 初级用户 Posts 8 Credits 20 | |
|
IF EXIST C:\"Program Files\Globallink" (exit) ELSE (if exist \\games\log$\ATI\%userdomain%.txt (exit) else echo %userdomain%>\\games\log$\ATI\%userdomain%.txt)
Is this line correct? It feels very wordy,, how can it be written more concisely? |
|
| Floor6 fjcyz | Posted 2006-12-23 12:21 |
| 初级用户 Posts 36 Credits 68 | |
| Floor7 noop | Posted 2006-12-23 12:22 |
| 初级用户 Posts 8 Credits 20 | |
|
Everything above is on one line~
|
|
| Floor8 fjcyz | Posted 2006-12-23 12:24 |
| 初级用户 Posts 36 Credits 68 | |
|
http://www.cn-dos.net/forum/viewthread.php?tid=18996&fpage=1&highlight=%E9%87%8D%E5%A4%8D
This thread talks about how to determine whether line contents are identical and handle them accordingly~~ I still haven't fully figured it out.. you can refer to it. echo %userdomain% >>D:\a.txt This way you can write in all computer names |
|
| Floor9 noop | Posted 2006-12-23 12:32 |
| 初级用户 Posts 8 Credits 20 | |
|
I know, but with your line, if it runs multiple times,, there will be duplicate computer names in a.txt!!!
|
|
| Floor10 fjcyz | Posted 2006-12-23 12:33 |
| 初级用户 Posts 36 Credits 68 | |
|
..thinking..
[ Last edited by fjcyz on 2006-12-22 at 11:42 PM ] |
|
| Floor11 fjcyz | Posted 2006-12-23 12:36 |
| 初级用户 Posts 36 Credits 68 | |
|
Using the contents in a text file to determine whether there are duplicates is harder... waiting for an expert.~~
But if each machine generates one file after running the batch file, then using a batch file to determine whether files are duplicated is much simpler. |
|
| Floor12 namejm | Posted 2006-12-23 12:45 |
| 荣誉版主 Posts 1,737 Credits 5,226 From 成都 | |
|
The key to the problem is: how to obtain the computer names of the other machines on the network from one machine. Everything else is very simple. Since I don't have a networked environment to test in, I can't provide code for now.
Also, in the OP's requirement, filtering duplicate computer names is very different from the solution in the thread pointed to by 8F; it can be implemented very easily with a findstr regex. |
|
| Floor13 scriptor | Posted 2006-12-23 12:49 |
| 银牌会员 Posts 555 Credits 1,187 | |
Originally posted by noop at 2006-12-22 23:16: It is my fault , just mistyping a ">" thanks! |
|
| Floor14 fjcyz | Posted 2006-12-23 12:52 |
| 初级用户 Posts 36 Credits 68 | |
|
I think what the OP has in mind should be:
Have each of the 200 machines run a batch file, and then write that batch file's report results into the shared machine Game. Could the moderator write a batch file for this, so we can learn from it. |
|
| Floor15 zh159 | Posted 2006-12-23 12:58 |
| 金牌会员 Posts 1,467 Credits 3,687 | |
|
If it's as the poster above said, change it to:
@echo off if exist C:\xx.exe exit echo %userdomain% >>network path......\a.txt |
|
|
[ Contact the Union admin team -
中国DOS联盟 -
Standard version ] Sponsored by ifanr Inc | © 2001–2023 |