婷婷综合国产,91蜜桃婷婷狠狠久久综合9色 ,九九九九九精品,国产综合av

主頁 > 知識庫 > PowerShell時間記錄腳本

PowerShell時間記錄腳本

熱門標簽:真人和電話機器人對話 金融電銷公司怎么辦理外呼系統 使用電話機器人電銷是否違法 電話智能外呼系統誠信合作 湖州電銷防封卡 什么渠道可以找外呼系統客戶 雷霆電話機器人電話 安徽400電話辦理 信陽話務外呼系統怎么收費

#initialization
   $timeInterval = 30 #監測間隔
   $record = @{"Coding" = 0; "Outlook Email" = 0; "Gmail" = 0; "Google Reader" = 0; "BBS" = 0; "Other Internet" = 0; "Documents" = 0;}
  $count = 0
  $date = date -format "yyyyMMdd"
  #try to resume
  if (test-path "d:\temp\timeRecord$date.txt") {
    gc "d:\temp\timeRecord$date.txt" | % {if ($_ -match "\w+\s+\d+") {
      $groups = [Regex]::Match($_, "^(\w+\s?\w+)\s+(\d+)").Groups;
      $record[$groups[1].Value] = [int]::Parse($groups[2].Value);
    }}
  }
  #start to monitor
  while ($true)
  {
    $titles = ps | ? {$_.MainWindowTitle} | select MainWindowTitle
    $titles | % {
      if ($_ -match "Google 閱讀器 - Windows Internet Explorer") {$record["Google Reader"]++;}
      else {if ($_ -match "Gmail - Windows Internet Explorer") {$record["Gmail"]++;}
      else {if ($_ -match "Internet Explorer") {$record["Other Internet"]++;}
      else {if ($_ -match "Visual Studio") {$record["Coding"]++;}
      else {if ($_ -match "Microsoft Word") {$record["Documents"]++;}
      else {if ($_ -match "Microsoft Office OneNote") {$record["Documents"]++;}
      else {if ($_ -match "Microsoft PowerPoint") {$record["Documents"]++;}
      else {if ($_ -match "Message (HTML)") {$record["Outlook Email"]++;}
      else {if ($_ -match "bbs") {$record["BBS"]++;}
      }}}}}}}}
    }
    sleep($timeInterval)
    $count = ($count + 1) % 10 #為了防止數據丟失,每10次記錄寫入文件一次
    if ($count -eq 0) {$record > "d:\temp\timeRecord$date.txt"}
  }

為了解技術思路,研究了一下powershell.
整個開發與部署過程如下:

1.下載WindowsXP-KB926139-v2-x86-ENU

安裝powershell環境;

2.按照代碼要求,寫一個簡單的腳本;

3. 運行powershell時,同 bat是有區別的.注意以下方法:

1) 解除限制:

set-executionpolicy Unrestricted

2) 將文件名保存為ps1
3) 通過以下方法運行(假如文件名是c:a.ps1)
PS C:> .a
[@more@]

示例代碼:

function foo ( [int] $x)
{
$x = $x + 1
echo $x
}
foo (1 )

您可能感興趣的文章:
  • linux中 shell 歷史命令記錄功能
  • 用來記錄登錄后使用命令的shell腳本
  • PowerShell小技巧之定時記錄操作系統行為
  • shell將腳本輸出結果記錄到日志文件的實現
  • Powershell小技巧之記錄腳本的操作
  • Powershell小技巧之用變量累積記錄錯誤
  • shell如何記錄用戶的IP與命令詳解

標簽:運城 濟南 湛江 岳陽 鶴崗 德州 山南 六盤水

巨人網絡通訊聲明:本文標題《PowerShell時間記錄腳本》,本文關鍵詞  PowerShell,時間,記錄,腳本,;如發現本文內容存在版權問題,煩請提供相關信息告之我們,我們將及時溝通與處理。本站內容系統采集于網絡,涉及言論、版權與本站無關。
  • 相關文章
  • 下面列出與本文章《PowerShell時間記錄腳本》相關的同類信息!
  • 本頁收集關于PowerShell時間記錄腳本的相關信息資訊供網民參考!
  • 推薦文章
    主站蜘蛛池模板: 罗江县| 喀什市| 高密市| 静宁县| 项城市| 综艺| 峨眉山市| 忻城县| 台北县| 合山市| 慈利县| 濮阳市| 玉屏| 西畴县| 孙吴县| 大埔区| 福泉市| 那曲县| 阜宁县| 佛冈县| 和林格尔县| 孝感市| 新干县| 平泉县| 青岛市| 台前县| 乾安县| 元谋县| 陵水| 永兴县| 蒲江县| 镇宁| 海林市| 普安县| 乡宁县| 望城县| 虹口区| 中山市| 庆阳市| 磐石市| 和林格尔县|