标题: 如何获取进程列表并保存服务器?
[打印本页]
作者: dxp04
时间: 2008-8-30 10:03
标题: 如何获取进程列表并保存服务器?
try this
for /f "skip=3" %%i in ('tasklist') do (echo %%i >>1.txt)
用以上命令可以获取进程并且保存为1.txt
但是我现在是个网吧 需要客户机把此文件按机器名字保存到服务器指定路径
也就是说1.txt中的1为机器名
或者 在1.txt中按机器名往下排下出每个PC的进程列表
我是个新手望指教~!
作者: HAT
时间: 2008-8-30 10:08
@echo off
type nul>"1.txt"
for /f "skip=3" %%i in ('tasklist') do (
>>"1.txt" echo %%i
)
copy /y "1.txt" "\\服务器地址\共享名"
作者: dxp04
时间: 2008-8-30 10:16
2楼只是加了个COPY命令 没明白我的意思
我意思是 按机器名称保存 不是单一的保存到服务器
例如 本机子机器名为 PC32 则 保存为PC32.TXT 并且COPY到服务器指定路径下
主要是这个PC32.TXT命令怎么加
[
Last edited by dxp04 on 2008-8-30 at 10:19 AM ]
作者: lxmxn
时间: 2008-8-30 11:16
用 hostname 把机器名读出来。
作者: HAT
时间: 2008-8-30 11:34
@echo off
type nul>"%computername%.txt"
for /f "skip=3" %%i in ('tasklist') do (
>>"%computername%.txt" echo %%i
)
copy /y "%computername%.txt" "\\服务器地址\共享名"