Board logo

标题: 查找局域网内的游戏或小说 [打印本页]

作者: wxs81514     时间: 2008-7-4 16:04    标题: 查找局域网内的游戏或小说

因为我们公司规定不允许在电脑上存放游戏(一般是单文件游戏)或小说,每个月都要去查核。现在有一个问题:一个游戏文件只要在局域网内传播,就很难根除掉。很多人都知道把文件名改了,甚至改扩展名,这样用一般的办法就很难查到。所以我想写一个批处理来查找这些文件,我们局域网内每台电脑开机都会运行批处理,我想把已经发现的游戏文件全部放到服务器上隐藏起来,然后用批处理来比较这些文件,如果大小是一样的,就把它的文件名和路径记录到服务器上的一个文件里。
    我有一个算法不知道科不科学:先用dir c:\ >>c:\tt.txt,以此类推把各盘的目录全部保存到tt.txt这个文件里,然后再在这个文件里查字节数字,比如游戏A的字节数为:138,115,查到之后把对应的文件名取出来(假设为xx.exe),再用dir X:\xx.exe /s/b>>\\server\out\out.txt,把路径和文件名保存起来。
    如果大家觉得我的算法可以,请教一下查找和取文件名那一段怎么写,如果不科学,请教一下更好的算法,提供一点思路也好,不胜感激。
作者: pusofalse     时间: 2008-7-4 16:12
真是严格的公司呢。。。^_^
作者: wxs81514     时间: 2008-7-4 21:10
台湾厂,都是这样,没办法,如果游戏被散布了资讯室要被罚的.
作者: pusofalse     时间: 2008-7-4 21:34
for %%i in (c d e f g h i j k l) do (
if exist %%i:\ (
cd /d %%i:\
for /r %%a in (*.*) do if %%~za equ 10000 echo %%a>>\\server\out\out.txt
))
输出重定向时不知会不会发生错误。。。先试下。。。
把这个批处理放到启动项里,开机自动运行。。。
至于如何隐藏窗口,要用VBS了。。。
不会VBS ^_^
作者: metoo     时间: 2008-7-4 23:19
用p作这事。。效率是不是低点。。话说看来以后要进这类厂加壳啥的东西都得学学。。。
作者: wxs81514     时间: 2008-7-4 23:26
多谢4楼的兄弟,算法很高明,for命令用得这么熟。
我试过了,很好用,能达到我的要求,就是CPU占用太高了。
有一条命令我看不懂,再请教一下:
if %%~za equ 10000 ,我知道数字是字节数,前面不知道。
我们公司用了VBS,谢谢
作者: pusofalse     时间: 2008-7-5 04:27


  Quote:
Originally posted by wxs81514 at 2008-7-4 11:26 PM:
多谢4楼的兄弟,算法很高明,for命令用得这么熟。
我试过了,很好用,能达到我的要求,就是CPU占用太高了。
有一条命令我看不懂,再请教一下: ...

for /?
%~I         - expands %I removing any surrounding quotes (")
%~fI        - expands %I to a fully qualified path name
%~dI        - expands %I to a drive letter only
%~pI        - expands %I to a path only
%~nI        - expands %I to a file name only
%~xI        - expands %I to a file extension only
%~sI        - expanded path contains short names only
%~aI        - expands %I to file attributes of file
%~tI        - expands %I to date/time of file
%~zI        - expands %I to size of file
%~$PATH:I   - searches the directories listed in the PATH
               environment variable and expands %I to the
               fully qualified name of the first one found.
               If the environment variable name is not
               defined or the file is not found by the
               search, then this modifier expands to the