China DOS Union

-- Unite DOS · Advance DOS · Grow DOS --

Union site: www.cn-dos.net Forum site: www.cn-dos.net/forum
DOS stands for freedom, openness and progress. Let us work hard, learn from the openness and GNU spirit of FreeDOS and Linux, and together build and grow a free GNU GPL world!

中国DOS联盟论坛
The time now is 2026-08-12 00:51
中国DOS联盟论坛 » DOS批处理 & 脚本技术(批处理室) » How to shorten this script View 1,179 Replies 1
Original Poster Posted 2010-09-19 12:59 ·  中国 北京 朝阳区 中国数码港科技有限公司BGP节点
初级用户
Credits 20
Posts 21
Joined 2010-05-20 21:00
16-year member
UID 167284
Gender Male
Status Offline
@echo off&setlocal enabledelayedexpansion
for /f %%i in ('date /t') do set a=%%i
for /f %%j in ('time /t') do set b=%%j
wmic process get name,WorkingSetSize,PrivatePageCount | findstr "QQ.exe" > %tmp%\111.txt
for /f "tokens=1,2,3 delims= " %%k in (%tmp%\111.txt) do set c=%%k&set d=%%l&set /A d=!d!/1024&set e=%%m&set /A e=!e!/1024

echo !a!!b! !c! !d!KB !e!KB>>(%date:~0,10%)front内存占用.txt

If I write it in VBS, how should I write it?
Floor 2 Posted 2010-09-20 10:59 ·  中国 北京 联通
高级用户
★★★
据说是李先生
Credits 609
Posts 400
Joined 2008-04-23 15:55
18-year member
UID 116706
Gender Male
Status Offline
f="("&Date&")front内存占用.txt" : g=String(11," ") : t=""
Set wmi=GetObject("winmgmts:{impersonationLevel=impersonate}!\\.\root\cimv2")
Set ps=wmi.ExecQuery("Select * from Win32_Process Where Name='QQ.exe'")
For Each p In ps
t=t&Now&g&p.Name&g&p.PrivatePageCount/1024&"KB"&g&p.WorkingSetSize/1024&"KB"&vbCrLf
Next
CreateObject("Scripting.FileSystemObject").OpenTextFile(f,8,True).Write t
Recent Ratings for This Post ( 1 in total) Click for details
RaterScoreTime
chen8919043 +1 2010-09-21 14:57
Forum Jump: