Quantcast
Channel: windows –易春木
Viewing all 57 articles
Browse latest View live

python fail in Cygwin? 自己裝一個吧

$
0
0

使用cygwin當作你在windows環境裡的unix-like介面, 如果遇到指令執行錯誤,像是python太舊的問題, 這裡有個workaround的方式提供~

1,錯誤發生:

File "/usr/lib/python2.6/subprocess.py", line 633, in __init__
errread, errwrite)
File "/usr/lib/python2.6/subprocess.py", line 1139, in _execute_child
raise child_exception
OSError: [Errno 2] No such file or directory

2. 分析一下是否環境變數路徑順序的問題
Vincent@VINCENTC_PC /cygdrive/d/codebase
$ python --version
Python 2.6.5

Vincent@VINCENTC_PC /cygdrive/d/codebase
$ which python
/usr/bin/python

Vincent@VINCENTC_PC /cygdrive/d/codebase
$ echo $path

Vincent@VINCENTC_PC /cygdrive/d/codebase
$ echo $PATH
/usr/local/bin:/usr/bin:/cygdrive/c/Perl/site/bin:/cygdrive/c/Perl/bin:/cygdrive/c/Program Files/ARM/bin/win_32-pentium:/cygdrive/c/Windows/system32:/cygdrive/c/Windows:/cygdrive/c/Windows/System32/Wbem:/cygdrive/c/Windows/System32/WindowsPowerShell/v1.0:/cygdrive/c/Program Files/Microsoft ASP.NET/ASP.NET Web Pages/v1.0:/cygdrive/c/Program Files/Windows Kits/8.0/Windows Performance Toolkit:/cygdrive/c/Program Files/Microsoft SQL Server/110/Tools/Binn:/cygdrive/c/Program Files/ARM/RVCT/Programs/4.1/713/win_32-pentium:/cygdrive/c/Program Files/ARM/RVI/Tools/4.2/39/programs/win_32-pentium:/cygdrive/c/Program Files/ARM/RVD/Core/4.1.2/38/win_32-pentium/bin:/cygdrive/c/Program Files/ARM/Utilities/FLEXlm/10.8.5.0/1/win_32-pentium:/cygdrive/c/Python27:/cygdrive/c/Program Files/Microsoft Visual Studio 11.0/VC/bin:/usr/lib/lapack

(看得出來cygwin創建的環境變數/usr/local/bin:/usr/bin優先於我自己安裝的新版/cygdrive/c/Python27)

3.備份舊版python, 讓系統找到後面環境變數裡的指令python

Vincent@VINCENTC_PC /cygdrive/d/codebase
$ mv /usr/bin/python /usr/bin/pythonBAK

Vincent@VINCENTC_PC /cygdrive/d/codebase
$ which python
/cygdrive/c/Python27/python

4. Build OK


Linux/UNIX 和 Windows平台下要怎麼知道環境變數?

$
0
0

In a command line expecting to see everything in your path on startup and saw only ‘PATH’

[LINUX/UNIX]
For those of you working with LINUX/UNIX and you’ve typed:
c:> echo $PATH

[windows]
How do I view/see the PATH in a windows environment?
c:> echo %path%

win7 / win8 用來分析短時間耗電資訊: powercfg /energy

$
0
0

指令 powercfg /energy
可以觀察短時間內找出耗電

Windows 7具有內建的電源檢查指令,
只要開啟命令提示字元,輸入「Powercfg /energy」,
便會自動偵測系統的電源設定,如果發現警告或錯誤訊息,也會在記錄檔中顯示相關的名稱及發生原因

 
更多訊息:
http://www.ithome.com.tw/itadm/article.php?c=52876

 

實際操作一下

 

 

以下內容為C:\energy-report.html

 

電源效率診斷報告

電腦名稱  xxxxxxxxxxxxxx
掃描時間 2013-01-22T08:38:27Z
掃描期間 60 秒
系統製造商 eMachines
系統產品名稱 eMachines 527
BIOS 日期 03/23/2010
BIOS 版本 V0.03
作業系統組建 7600
平台角色 PlatformRoleMobile
一般電源 true
處理程序計數 82
執行緒計數 1019
報告 GUID {xxxx-xxxx-xxxx-xxxx-xxxx}

分析結果

錯誤

USB 暫停:USB 裝置未進入暫停狀態
USB 裝置未進入暫停狀態。如果 USB 裝置在停止使用時未進入暫停狀態,可能是因為停用了處理器電源管理。
裝置名稱 USB Root Hub
主機控制器識別碼 PCI\VEN_8086&DEV_2934
主機控制器位置 PCI bus 0, device 29, function 0
裝置識別碼 USB\VID_8086&PID_2934
連接埠路徑
USB 暫停:USB 裝置未進入暫停狀態
USB 裝置未進入暫停狀態。如果 USB 裝置在停止使用時未進入暫停狀態,可能是因為停用了處理器電源管理。
裝置名稱 USB 輸入裝置
主機控制器識別碼 PCI\VEN_8086&DEV_2934
主機控制器位置 PCI bus 0, device 29, function 0
裝置識別碼 USB\VID_1C4F&PID_0003
連接埠路徑 1
CPU 使用率:高處理器使用率
追蹤期間的平均處理器使用率很高。當平均的處理器使用率非常低時,系統會耗用較少量電源。檢閱個別處理程序的處理器使用率,判斷佔總處理器使用率最高的應用程式與服務。
平均使用率 (%) 19.62

警告

電源原則:802.11 無線電波電源原則是最高效能 (一般電源)
目前 802.11 相容無線網路介面卡的電源原則未設定為使用低電源模式。
CPU 使用率:具有高處理器使用率的個別處理程序。
這個處理程序佔追蹤期間所記錄之總處理器使用率的一大部分。
處理程序名稱 iexplore.exe
PID 6076
平均使用率 (%) 3.31
模組 平均模組使用率 (%)
\Device\HarddiskVolume2\Windows\System32\mshtml.dll 1.41
\SystemRoot\system32\ntkrnlpa.exe 0.29
\Device\HarddiskVolume2\Windows\System32\jscript9.dll 0.27
CPU 使用率:具有高處理器使用率的個別處理程序。
這個處理程序佔追蹤期間所記錄之總處理器使用率的一大部分。
處理程序名稱 ssh.exe
PID 5428
平均使用率 (%) 2.26
模組 平均模組使用率 (%)
\SystemRoot\system32\ntkrnlpa.exe 1.02
\Device\HarddiskVolume2\Program Files\Git\bin\msys-crypto-0.9.8.dll 0.22
\Device\HarddiskVolume2\Windows\System32\ntdll.dll 0.15
CPU 使用率:具有高處理器使用率的個別處理程序。
這個處理程序佔追蹤期間所記錄之總處理器使用率的一大部分。
處理程序名稱 dwm.exe
PID 2780
平均使用率 (%) 2.22
模組 平均模組使用率 (%)
\Device\HarddiskVolume2\Windows\System32\igd10umd32.dll 0.92
\Device\HarddiskVolume2\Windows\System32\dwmcore.dll 0.60
\SystemRoot\System32\drivers\dxgmms1.sys 0.15
CPU 使用率:具有高處理器使用率的個別處理程序。
這個處理程序佔追蹤期間所記錄之總處理器使用率的一大部分。
處理程序名稱 System
PID 4
平均使用率 (%) 2.09
模組 平均模組使用率 (%)
\SystemRoot\system32\ntkrnlpa.exe 0.73
\SystemRoot\system32\DRIVERS\bcmwl5.sys 0.41
\SystemRoot\System32\drivers\tcpip.sys 0.27
CPU 使用率:具有高處理器使用率的個別處理程序。
這個處理程序佔追蹤期間所記錄之總處理器使用率的一大部分。
處理程序名稱 iexplore.exe
PID 6588
平均使用率 (%) 1.42
模組 平均模組使用率 (%)
\Device\HarddiskVolume2\Windows\System32\mshtml.dll 0.67
\SystemRoot\system32\ntkrnlpa.exe 0.13
\SystemRoot\System32\win32k.sys 0.12
CPU 使用率:具有高處理器使用率的個別處理程序。
這個處理程序佔追蹤期間所記錄之總處理器使用率的一大部分。
處理程序名稱 git.exe
PID 10424
平均使用率 (%) 1.33
模組 平均模組使用率 (%)
\Device\HarddiskVolume2\Program Files\Git\bin\git.exe 0.97
\SystemRoot\system32\ntkrnlpa.exe 0.15
\SystemRoot\System32\Drivers\Ntfs.sys 0.05
CPU 使用率:具有高處理器使用率的個別處理程序。
這個處理程序佔追蹤期間所記錄之總處理器使用率的一大部分。
處理程序名稱 AppM.ls
PID 11864
平均使用率 (%) 1.03
模組 平均模組使用率 (%)
\SystemRoot\system32\ntkrnlpa.exe 0.56
\SystemRoot\System32\win32k.sys 0.17
\SystemRoot\system32\halmacpi.dll 0.12
CPU 使用率:具有高處理器使用率的個別處理程序。
這個處理程序佔追蹤期間所記錄之總處理器使用率的一大部分。
處理程序名稱 explorer.exe
PID 2804
平均使用率 (%) 0.76
模組 平均模組使用率 (%)
\SystemRoot\System32\win32k.sys 0.33
\SystemRoot\system32\ntkrnlpa.exe 0.14
\Device\HarddiskVolume2\Windows\System32\msvcrt.dll 0.04
CPU 使用率:具有高處理器使用率的個別處理程序。
這個處理程序佔追蹤期間所記錄之總處理器使用率的一大部分。
處理程序名稱 svchost.exe
PID 1516
平均使用率 (%) 0.58
模組 平均模組使用率 (%)
\Device\HarddiskVolume2\Windows\System32\FntCache.dll 0.47
\SystemRoot\system32\ntkrnlpa.exe 0.10
\Device\HarddiskVolume2\Windows\System32\ntdll.dll 0.00
CPU 使用率:具有高處理器使用率的個別處理程序。
這個處理程序佔追蹤期間所記錄之總處理器使用率的一大部分。
處理程序名稱 OUTLOOK.EXE
PID 4780
平均使用率 (%) 0.53
模組 平均模組使用率 (%)
\SystemRoot\system32\ntkrnlpa.exe 0.10
\Device\HarddiskVolume2\Program Files\Microsoft Office\Office14\OUTLOOK.EXE 0.07
\Device\HarddiskVolume2\Program Files\Common Files\microsoft shared\OFFICE14\MSO.DLL 0.06
CPU 使用率:具有高處理器使用率的個別處理程序。
這個處理程序佔追蹤期間所記錄之總處理器使用率的一大部分。
處理程序名稱 Skype.exe
PID 4220
平均使用率 (%) 0.47
模組 平均模組使用率 (%)
\Device\HarddiskVolume2\Program Files\Skype\Phone\Skype.exe 0.37
\SystemRoot\system32\ntkrnlpa.exe 0.03
\SystemRoot\System32\win32k.sys 0.01
CPU 使用率:具有高處理器使用率的個別處理程序。
這個處理程序佔追蹤期間所記錄之總處理器使用率的一大部分。
處理程序名稱 csrss.exe
PID 484
平均使用率 (%) 0.44
模組 平均模組使用率 (%)
\SystemRoot\System32\win32k.sys 0.17
\SystemRoot\system32\ntkrnlpa.exe 0.16
\SystemRoot\system32\DRIVERS\igdkmd32.sys 0.03
CPU 使用率:具有高處理器使用率的個別處理程序。
這個處理程序佔追蹤期間所記錄之總處理器使用率的一大部分。
處理程序名稱 iexplore.exe
PID 2296
平均使用率 (%) 0.42
模組 平均模組使用率 (%)
\SystemRoot\System32\win32k.sys 0.18
\SystemRoot\system32\ntkrnlpa.exe 0.08
\SystemRoot\system32\halmacpi.dll 0.02
CPU 使用率:具有高處理器使用率的個別處理程序。
這個處理程序佔追蹤期間所記錄之總處理器使用率的一大部分。
處理程序名稱 AcroRd32.exe
PID 6792
平均使用率 (%) 0.31
模組 平均模組使用率 (%)
\Device\HarddiskVolume2\Program Files\Adobe\Reader 9.0\Reader\AcroRd32.dll 0.08
\SystemRoot\system32\ntkrnlpa.exe 0.08
\Device\HarddiskVolume2\Windows\System32\ntdll.dll 0.02
CPU 使用率:具有高處理器使用率的個別處理程序。
這個處理程序佔追蹤期間所記錄之總處理器使用率的一大部分。
處理程序名稱 PccNTMon.exe
PID 3012
平均使用率 (%) 0.29
模組 平均模組使用率 (%)
\SystemRoot\system32\ntkrnlpa.exe 0.11
\SystemRoot\System32\Drivers\Ntfs.sys 0.04
\SystemRoot\system32\drivers\fltmgr.sys 0.03
CPU 使用率:具有高處理器使用率的個別處理程序。
這個處理程序佔追蹤期間所記錄之總處理器使用率的一大部分。
處理程序名稱 hmonitor.exe
PID 276
平均使用率 (%) 0.26
模組 平均模組使用率 (%)
\SystemRoot\System32\win32k.sys 0.09
\SystemRoot\system32\ntkrnlpa.exe 0.07
\Device\HarddiskVolume2\Windows\System32\usp10.dll 0.02

資訊

平台計時器解析度:平台計時器解析度
預設的平台計時器解析度是 15.6ms (15625000ns),且應在每次系統閒置時使用。如果計時器解析度增加,則處理器電源管理技術就會沒有效率。計時器解析度可能會因為播放多媒體或圖形動畫而增加。
目前的計時器解析度 (100ns 個單位) 156000
電源原則:使用中電源計劃
目前正在使用的電源計劃
計劃名稱 OEM 平衡
計劃 GUID {381b4222-f694-41f0-9685-ff5bb260df2e}
電源原則:電源計劃特質 (使用電池)
目前的電源計劃在系統使用電池電力時的特質。
特質 平衡
電源原則:視訊品質 (使用電池)
讓 Windows Media Player 在播放視訊時最佳化品質或節省電力。
品質模式 在視訊品質與省電之間取得平衡
電源原則:電源計劃特質 (一般電源)
目前的電源計劃在系統使用一般電源時的特質。
特質 平衡
電源原則:視訊品質 (一般電源)
讓 Windows Media Player 在播放視訊時最佳化品質或節省電力。
品質模式 最佳化視訊品質
系統可用性要求:分析成功
分析成功。未發現任何電源效率問題。沒有傳回任何資訊。
電池:電池資訊
電池識別碼 8364SANYO AS09A31
製造商 SANYO
序號 8364
化學 Lion
長效 1
設計容量 47520
上次充滿 25531
平台電源管理容量:支援的睡眠狀態
睡眠狀態允許電腦在一段時間不活動之後進入低電源模式。S3 睡眠狀態是 Windows 平台的預設睡眠狀態。S3 睡眠狀態只會消耗足以保留記憶體內容的電源,並允許電腦快速恢復運作。只有極少數平台支援 S1 或 S2 睡眠狀態。
支援 S1 睡眠狀態 false
支援 S2 睡眠狀態 false
支援 S3 睡眠狀態 true
支援 S4 睡眠狀態 true
平台電源管理容量:支援彈性顯示器亮度。
這部電腦可讓 Windows 自動控制整合式顯示器的亮度。
平台電源管理容量:處理器電源管理容量
有效率的處理器電源管理可讓電腦自動平衡效能與電源消耗。
群組 0
索引 0
閒置 (C) 狀態計數 2
效能 (P) 狀態計數 3
節流閥 (T) 狀態計數 8
平台電源管理容量:處理器電源管理容量
有效率的處理器電源管理可讓電腦自動平衡效能與電源消耗。
群組 0
索引 1
閒置 (C) 狀態計數 2
效能 (P) 狀態計數 3
節流閥 (T) 狀態計數 8

windows 程式開發: Batch File Command 概述一下

$
0
0

有一些常出現的關鍵字如下, 把這些學起來
就已經會了一大半了, 加油!!

常見關鍵字/符號:

@
ECHO
FOR
IF
PAUSE
%VARIABLE%
%DIGIT
REM
CLS

開始介紹:

——————————————————————————–

@ 隱藏其後的指令,不會顯示於Command Prompt中.

可用於簡化畫面;也或者不想讓人知道下了何種指令?(Hacking?)
Syntax:
@[Command]
Example:
@echo Off

ECHO 顯示其後的訊息

Syntax:
echo [On|Off|Message|.]
Example:
echo 顯示echo目前狀態(On or Off)
echo Off 隱藏Windows Command Prompt中的訊息
echo On 恢復顯示Windows Command Prompt中的訊息
echo Hello world! 在Command Prompt顯示Hello world!
echo. 顯示空行
echo N|del *.* 預先提供答案給指令. (del *.*? => No)

FOR 對清單中每個成員重複執行相同指令.

Syntax:
FOR %%argument IN (list) DO command
argument – 從A-Za-z任何字元皆可
list – 由逗號,或空格所隔開的字串皆可
command- 指令
Example:
FOR %%i IN (A,B,C) DO echo %%i
印出A,B,C
FOR %%f IN (*.TXT *.BAT *.DOC) DO type %%f
印出所有txt, bat, doc檔案內容
FOR %%f IN (*.PAS) DO call compile %%f
Complile所有PAS檔案

IF 判斷式.

Syntax:
IF [not] condition (
command [command-parameter]
) ELSE (
command [command-parameter]
)
Example:
IF string1==string2 echo string1 equal to string2
如果string1等於string2,在螢幕上印出string1 equal to string2
IF exist a.txt echo del a.txt
如果a.txt存在則刪除他

PAUSE 暫停執行批次程式,並且顯示 Press any key to continue…

Syntax:
PAUSE
Example:
pause

SET 顯示,設定環境變數

Syntax:
SET [ variable=[string]]
Example:
set 顯示目前環境變數
set P 列出所有以’P’開頭的環境變數
set USER=Tom 將USER加入環境變數中
set PATH=C:\test;%PATH%
將C:\test加入目前的環境變數中(只對當前的Command Prompt有效)
set /P str=Message
在螢幕上顯示Message,並將使用者輸入設定為變數str

%Variable% 代表該環境變數的值

Syntax:
%Variable%
Example:
set USER=Tom
echo %USER% 螢幕將顯示Tom

%DIGIT batch file所接受的參數

Syntax:
%digit digit可接受數字為1~9
Example:
C:\test.bat string
%1將等於"string"

REM 註解符號

也可以用 :: 代替
Syntax:
REM [Message]
:: [Message]
Example:
REM this is comment
:: this is comment

CLS 清除畫面

Syntax:
CLS
Example:
cls

windows 7 與 win 8 開發multi-touch多點觸控重要參考範例

$
0
0

最近工作需求需要撰寫一款Application能夠測試多點觸控, 也就是multi-touch! 在網路上找了很久, 可能是win8太新了吧, 所以大多論壇都無法提供有效的資源, (但也有可能是我沒找到) 如果你要做的是單點觸控的話,有個比較簡單的做法,就是利用mouse-down,mouse-move的windows form application內建的事件觸發即可完成! 但這樣是把滑鼠當成觸控使用啦~

但我想要做的是多點觸控, 於是找了很多資源

我覺得最有效的是這個網址, 它有說明也有範例檔! 非常棒, 讓我可以直接依據範例做修改, 從這裡我相信可以讓你很快的入門!!

因為這個範例提供三種方式的範例:

1. Win32
2. MultitouchWinForms
3. MutlitouchWPF

而我就是衝著 windows form application 而來的,

因為我要做一個可以讓使用者介面的form application
可以下載看看囉!
網址:http://archive.msdn.microsoft.com/Project/Download/FileDownload.aspx?ProjectName=WindowsTouch&DownloadId=5038

更多範例:
http://msdn.microsoft.com/en-us/library/windows/desktop/dd562199%28v=vs.85%29.aspx

我的討論串
http://social.msdn.microsoft.com/Forums/zh-TW/8439d517-8779-4576-a607-40f9cb57e270/c-?forum=233


後記: 卡關中-被high resolution螢幕造成部分畫面無法顯示

此兩個連結說不定是正解…
http://msdn.microsoft.com/en-us/magazine/ee336016.aspx
http://msdn.microsoft.com/en-us/library/windows/desktop/dd464660(v=vs.85).aspx

可內嵌執行檔exe的C#

http://www.dotblogs.com.tw/larrynung/archive/2013/02/23/91701.aspx

C# 開發錄影 record vedio功能 window media player 使用DirectX.Capture與DirectShow.NET

$
0
0

首先請先到這個網站, 有個強者寫好sample囉, 還有講解~
http://dashingquill.wordpress.com/2012/06/27/capturing-webcam-using-directshow-net-library/

我也是這樣完成了
但是有一天, 出現問題我在某台windows x86 device無法錄到影像
也就是有影無聲的狀況..
因此我需要 library source code
而剛才說到的網站只有 .dll檔

於是乎, 我去找src code
找到年代久遠的source code
http://www.codeproject.com/Articles/3566/DirectX-Capture-Class-Library

目前正在debug中

其他參考資訊:
.net中捕获摄像头视频的方式及对比(How to Capture Camera Video via .Net)
DirectShowNET Library
The Filter Graph and Its Components

[C#] winForm執行另一個WPF程序並得到回傳值

$
0
0

我的範例 : WinForm端 (Parent)

呼叫 RunWPF() 就會去執行叫起 WPF process
如下程式碼

106 private void RunWPF()\r
107 {\r
108 Task.Run(() => RunWPFProcess());\r
109 }\r
110 \r
111 private void RunWPFProcess()\r
112 {\r
113 int ReturnValue = -1;\r
114 Process process = new Process();\r
115 process.StartInfo.FileName = “myWPF.exe“;\r
116 \r
117 try\r
118 {\r
119 process.Start();\r
122 process.WaitForExit(Int32.MaxValue);\r
123 ReturnValue = process.ExitCode;\r
124 }\r
125 catch (System.Exception ex)\r
126 {\r
127 }\r
128 \r
129 if (ReturnValue == 1)\r
130 {\r
131 /* You can do what you want as return value is 1 */ \r
137 }\r
138 else \r
139 {\r
140 /* You can do what you want as others */ \r
146 }\r
147 }\r

另一端WPF部分: (Child)

myWPF.exe 裡面程式碼,
這裡我就直接寫出如何傳值回去給winform程序
其他一概省略..

227 Environment.ExitCode = 1;\r
228 this.Close();\r

在windows上 使用android開發工具 adb tool (其實免安裝, 下載就可以)

$
0
0

其實很簡單

步驟一: 下載Android SDK
檔案有點大,要等一段時間
http://developer.android.com/sdk/index.html

步驟二: 解壓縮 SDK
我下載下來的檔案是adt-bundle-windows-x86_64-xxxxx.zip 給64bits電腦使用
請按右鍵解壓縮吧~~

步驟三: 複製路徑到環境變數PATH
請找一下adb所在的位置
然後把該路徑從網址列copy下來~

再到我的電腦按右鍵>內容>環境變數
找到PATH這個變數, 將剛copy的位置加入PATH的後面 (記得要用;作分隔)


Unix 與 MS-DOS 指令對照表 (Linux v.s Windows)

$
0
0

最近作一些專案兩個平台都會用到, 所以只熟悉UNIX的指令不夠用, 為了更有效率工作, 也得把windows指令記一下, 反正常用就知道了! 部分內容參考這裡 ..

.
.

Unix

MS-DOS

 說   明   例          子 
cd cd 進入目錄 cd ..
mkdir md 開子目錄 mkdir hello
pwd cd 顯示目前目錄 pwd
env set 顯示目前環境變數 env
setenv set 設定環境變數 setenv pp pwd
rm del 殺檔案 rm -r hello
cat/more type 顯示檔案內容 more .login
ls dir 顯示檔案 ls
lp print 列印檔案 lp .login
cp copy 複製檔案 cp .login anotherfile
date date/time 時間顯示.設定 date
mv ren 移動,重新命名檔案 mv .login .login.orig
man help 線上指令查詢 man ps
passwd 改變密碼
mail 電子郵件
write 傳送訊息給目前線上使用者
ps 顯示 processes
find 顯示 processes

寫了一個修改route的batch檔 for Windows O.S

$
0
0

在windows寫一個batch檔控制route table路由
紀錄如下,

我會將電腦連接到另一外網, 而原本預設的gateway 10.55.11.253 要清掉
改成 10.x.x.x 與 110.x.x.x 的IP網址才經由 10.55.11.253 gateway出去
其他預設則皆由外網出去 (未加入batch裡)

@echo off
cls
:start
echo ----------------------------------
echo delete 0.0.0.0 mask 0.0.0.0 10.55.11.253
route delete 0.0.0.0 mask 0.0.0.0 10.55.11.253
echo delete 10.0.0.0 mask 255.0.0.0 10.55.11.253
route delete 10.0.0.0 mask 255.0.0.0 10.55.11.253
echo delete 110.0.0.0 mask 255.0.0.0 10.55.11.253
route delete 110.0.0.0 mask 255.0.0.0 10.55.11.253
echo add 10.0.0.0 mask 255.0.0.0 10.55.11.253
route add 10.0.0.0 mask 255.0.0.0 10.55.11.253
echo add 110.0.0.0 mask 255.0.0.0 10.55.11.253
route add 110.0.0.0 mask 255.0.0.0 10.55.11.253
echo ----------------------------------
echo Press any key to left
echo ----------------------------------
pause
echo Bye!
exit
  • echo off 是將這個 把bat位置和指令暴露出來的設定 取消
  • echo on 則是把這個設定開啟
  • CLS : Clears the video display screen, setting the cursor in the upper left-hand corner.
  • pause 是用來暫停程式,不然沒指令後程式會自我關閉 (PAUSE : Pauses the running of a batch file and displays the message “Press any key to continue …" on the screen. If the optional message is included, it will be displayed first. Use pause to optionally terminate the batch file with at a safe place. The optional message is not displayed when echo is OFF, so the message must be echoed on the preceding line.)

更多batch關鍵字查詢

Windows平台作-S3 S4 測試 – PWRTEST.exe

$
0
0

微軟其實自己當然會開發一些測試指令給大家使用囉!

1. 先下載 Windows Driver Kit http://www.microsoft.com/download/en/details.aspx?id=11800

2. 至 C:\WinDDK\6001.18001\tools\acpi\pwrtest,底下有 x86 for 32 bits
,amd64 for 64 bits
, IA64是Intel Itanium 處理器…是特殊用途的處理器

3. Copy PWRTEST.exe 至待測機,

4. Open the cmd.exe and run as administrator. (注意:不懂請參考以下網址: http://support.microsoft.com/kb/981174/zh-tw)

5. 參考執行語法: pwrtest /sleep /s:3 /c:500 /d:30 /p:30

/s:3 – S3 test
/c:100 – 100 cycle
/d:90 – S0~S3 delay timing
/p:30 – set the timing for resume form S3

關於WMI的 WQL語言簡介和WQL測試工具wbemtest.exe使用方法詳細介紹

$
0
0

這篇文章主要介紹了WQL語言簡介和WQL測試工具wbemtest.exe使用方法詳細介紹,WQL是指Windows管理規範查詢語言,需要的朋友可以參考一下 (原文出處: .net中的WMI编程(二):WMI中的WQL语言和WQL的测试工具)

WQL就是WMI中的查詢語言,WQL的全稱是WMI Query Language

簡稱為WQL,翻譯成中文好像可以成為Windows管理規範查詢語言。熟悉SQL語言的朋友會感覺它和SQL非常相似。

WQL其實非常簡單,它有如下特點:
1、每個WQL語句必須以SELECT開始;
2、SELECT後跟你需要查詢的屬性名(我剛才對應SQL將其稱之為字段名了),也可以像SQL一樣,以 * 表示返回所有屬性值;
3、FROM關鍵字;
4、你要查詢的類的名字;
5、另外,如果你想精確查詢結果還可以加上WHERE條件從句。比如某個類有Enable屬性,你可以在查詢的時候加上WHERE ENABLE=true。

如以下的都是正確的WQL語句:

Select * From Win32_LogicalDisk where drivetype=3 '‘'‘查詢所有硬盤分區
SELECT * FROM Win32_share '‘查詢所有共享目錄
SELECT * FROM Win32_NetworkAdapterConfiguration WHERE DHCPEnabled=TRUE
SELECT Description FROM Win32_Account WHERE Name='Administrator'
SELECT Freespace,DeviceID FROM Win32_LogicalDisk

在Windows作業系統中都會有一個內建的WQL測試工具,叫wbemtest.exe

用它就能查看有哪些類和類有哪些 屬性,使用方法如下:
首先,運行wbemtest.exe,如下圖:

點“確定”之後會出現一個“Windows管理規範測試器”的窗口,如下圖:

點擊“連接”會出現一個對話框,我們可以選擇連接本地主機或者遠程主機,如下圖:

如果是本機測試並且是用管理員身份登錄,可以不用填寫用戶名和密碼,
如果是鏈接遠程主機則需要填寫遠程主機上的用戶名和密碼(建議使用遠程主機上的管理員身份登錄),點擊“連接”之後就會回到主界面。注意,只有登錄之後才能查看和查詢。

點擊“查詢”按鈕,輸入我們要查詢的WQL語句,
如"Select * From Win32_LogicalDisk",這是查詢系統邏輯驅動器的WQL語句,如圖:

這是我們多半會得到一個號碼為"0x80041010″ ,
描述為"無效類別"的錯誤,如下圖:

出現這個錯誤是因為剛開始默認的名稱空間為"root/default",這時我們需要更改名稱空間。
再點擊“連接”按鈕,將默認的"root/default"更改為"root/cimv2″,然後再點"連接"按鈕,如下圖:

登錄成功之後我們就可以查看系統有哪些類,並且還可以執行WQL查詢了。
點擊"枚舉類別"按鈕,然後在彈出的對話框中輸入要查找的類名就可以查詢類的屬性了。
如下圖(注意:我沒有填寫超類別名稱,並且選中"遞歸"單選按鈕,這樣就是遞歸列舉系統中所有的類):

查詢結果如下圖:

這些可都是有用的東西哦,如果你細心,你會這個列表裡發現我以前所用到的WQL語句裡設計到的所有的類,如Win32_LogicalDisk、Win32_share等等。
需要注意的是,有些還有括號,這些是方法。

下面是一些查詢的結果:

我們還可以對其中某一項數據雙擊查看屬性,如下圖:

如果我們不習慣這種方式查看,我們還可以點擊上面這個窗口中的"顯示MOF“按鈕,
下圖是我點擊"顯示MOF“按鈕的結果:

從上面的圖裡就能看出這個類有哪些屬性及對應的屬性值了。

關於WMI- 用 wbemtest 去撈SMBiosData的資料出來

$
0
0

本文只是一個小範例, 怎麼透過 wbemtest.exe 這個GUI界面, 去撈SMBiosData的資料出來!

首先打開 wbemtest.exe 吧!

第1步: 修改namespace為 root\wmi
第2步: 按 Query 以進入搜尋界面
第3步: 輸入 SELECT SMBiosData FROM MSSMBios_RawSMBiosTables
第4步: 按Apply

按完Apply後, 會跳出以下畫面
第1步: 雙擊這個Qurey result的項目, 會跳出result
第2步: 去找出SMBiosData, 再度雙擊會看見RawData
第3步: Raw Data

windbg 要怎麼切換從32至64bits 模式: .effmach x86 或 !wow64exts.sw

$
0
0

(原文出處: How do I switch to 32bit mode when I use windbg to debug a dump of a 32bit application running on an x64 machine? )

這篇文章裡面會介紹, 當你使用windbg來除錯一個dump檔
而它又是32bits的應用程式跑在x64機器上的dump檔, 如何從 32bit mode切換到 x64 machine.

假如你是32bit或64bit版本的windbg, 去開啟 32bit Application跑在x64作業系統上的Dump檔, 預設就是指你用64bit的模式去看32bit的application, 如下例, 會出現很多 wow64xxxx的字串

0:001> k 
Child-SP RetAddr Call Site 
00000000`027eebc8 00000000`7529ab46 wow64cpu!WaitForMultipleObjects32+0x3a 
00000000`027eec70 00000000`7529a14c wow64!RunCpuSimulation+0xa 
00000000`027eeca0 00000000`777305a8 wow64!Wow64LdrpInitialize+0x4b4 
00000000`027ef200 00000000`776e68de ntdll!_LdrpInitialize+0x49db8 
00000000`027ef2b0 00000000`00000000 ntdll!LdrInitializeThunk+0xe

0:001> r 
rax=000000000af7e3b8 rbx=00000000778ecb94 rcx=00000000004b6a18 
rdx=0000000000000018 rsi=00000000004b6a18 rdi=0000000000000000 
rip=000000007577374f rsp=00000000027eebc8 rbp=0000000002a9fee0 
r8=000000000000002b r9=00000000778c99fd r10=0000000000000000 
r11=0000000000000212 r12=000000007efd8000 r13=00000000027efd20 
r14=00000000027eec00 r15=0000000075773380 
iopl=0 nv up ei pl nz ac pe nc 
cs=0033 ss=002b ds=002b es=002b fs=0053 gs=002b efl=00000212 
wow64cpu!WaitForMultipleObjects32+0x3a: 
00000000`7577374f 418bbda0000000 mov edi,dword ptr [r13+0A0h] ds:00000000`027efdc0=00000000

這些wow64xxxx的字串在這些call stack根本無法給我們想要的訊息!
The wow64 stuff in the call stack and the x64 registers do not tell us much.

切換成用32bit的視角來看吧! 透過 .effmach x86 或 !wow64exts.sw 就可以囉!
To get the meaningful 32bit look of the application, you need to switch the processor mode that the debugger uses to 32bit by entering either .effmach x86 or !wow64exts.sw in windbg. The two commands are basically same. You should see output like the following:

0:001> !wow64exts.sw 
Switched to 32bit mode

0:001:x86> k 
ChildEBP RetAddr 
02a9fd4c 7794787d ntdll_77880000!NtWaitForMultipleObjects+0x15 
02a9fee0 7730eccb ntdll_77880000!TppWaiterpThread+0x328 
02a9feec 778fd24d kernel32!BaseThreadInitThunk+0xe 
02a9ff2c 778fd45f ntdll_77880000!__RtlUserThreadStart+0x23 
02a9ff44 00000000 ntdll_77880000!_RtlUserThreadStart+0x1b

0:001:x86> r 
eax=00000000 ebx=778ecb94 ecx=00000000 edx=00000000 esi=004b6a18 edi=00000000 
eip=778c99fd esp=02a9fd50 ebp=02a9fee0 iopl=0 nv up ei pl nz na po nc 
cs=0023 ss=002b ds=002b es=002b fs=0053 gs=002b efl=00000202 
ntdll_77880000!NtWaitForMultipleObjects+0x15: 
778c99fd c21400 ret 14h

果然看起來很不一樣吧!
The call stack looks very different now. Particularly you do not see any wow64 and wow64cpu modules in the stack.

以上的方法也適用於x64 kernel dump 在32bits處理器
Note: The above solution works for the kernel mode dump of an x64 system too when you try to see the thread call stacks of a running 32bit process.

[轉] 使用Performance Monitor監控CPU、Memory、Network與Disks

$
0
0

(文章出處: [[使用Performance Monitor監控CPU、Memory、Network與Disks]] 阿兩的筆記本 Ryoutsu’s Notebook )

使用Performance Monitor監控CPU、Memory、Network與Disks

Purpose

我希望能夠在裝某個軟體後,知道它對系統效能的影響。我們使用Windows Vista之後所內建的Performance Monitor,去對CPU、Memory、Network與Disks四個項目做監控與評估。接下來將告訴大家如何使用這個工具去達到這個目的。

Create New Data Collector Set

首先, 開啟Performance Monitor工具: start > run > perfmon
在Data Collector Sets中,System Performance已提供大部分能滿足我們需求的內容。包含: (只列出我們需要的部分,實際有更多資訊)

CPU: CPU使用率。
Memory: Memory使用率。
Network: 每秒接收或送出的封包、接受與送出所使用掉的Bytes數。
Disks: 硬碟每秒的讀寫速度。
但我們還需要硬碟的使用量與定義收集資料的時間(預設1分鐘)。

首先來建立一個新的Data Collector Set:

在User Defined點右鍵 > New > Data Collector Set。
輸入自訂名稱,選擇Create from a template。
選擇System Performance為範本。
直接按Finish。(後續的設定不是這麼重要)

Change Properties

為了要設定我們想要的監控時間,我們可以做工作排程或設置停止監控的時間:

對Data Collector Set點右鍵。
選擇Properties。
切到Stop Condition的頁籤。
選擇多久後停止。

如果是為了要知道某些時段的效能,可以切到Schedule頁籤設定時間區段。

Change Performance Counter

在System Performance範本中,僅提供PhysicalDisk Counter。我們需要的剩餘空間(Free Space)是屬於LogicalDisk Counter,所以我們必須新增這個Counter。

選擇新增的Data Collector Counter。
雙擊右邊的Performance Counter會出現Performance Counter Properties對話盒。
點擊Add,並找尋LogicalDisk。
LogicalDisk包含許多項目,我選擇所有加入。
加入LogicalDisk 項目至右方,你也可以選擇你要監控的磁碟分割。
按OK關閉新增Counter與修改Properties對話盒,即新增完成。
在Properties對話盒中,你也可以針對不同Counter,選擇採樣Interval時間。

其實我們只需要Free Space,但想說反正都做一次功,就一起抓一抓。最後等到報表再選擇想要呈現的部分。

Running

對要執行的Data Collector Counter點右鍵並點Start,即開始執行(同時間只允許一個工作)。此時Reports對應目錄中會產生出顯示還在執行的報表:

Reports

在工作執行完成後,點擊Report會有文字報表,大致看這張就可以知道結果了。

但如果要提供更能說服人的圖表,如監控時間的效能變化折線圖,可以對Report右鍵>View>Performance Monitor:

圖表畫面如下:

a: 查看當前活動內容。
b: Performance Monitor的屬性。
c: 改變圖表種類。
d: 新增要顯示的Counter內容。
e: 目前顯示的Counters列表。

屬性對話盒主要可以讓你選擇資料來源與顯示的Counters項目,算是設定大雜燴:

Summary

整體來說,算是很勇猛的工具,光CPU、Memory、Network與Disks就足夠讓我判斷某個軟體吃不吃資源。在這篇文章中,我只講我所需要的部分,其中更詳細的設定,可能要等到我有需要才會深究吧! 最後附上一張我用的Counters:


(其中Network Interface是針對某張網卡顯示,Processor也可以針對某個Core顯示)


MEInfoWin64.exe 可以獲得詳細內容 Intel Management Engine Interface components

$
0
0

Since Microsoft has done some fundamental changes regarding the system files, some processes/features will not run under Win8.1 the same way as under Win7 or Win8.

Users, who want to get detailed informations regarding the Intel Management Engine Interface components of their system (MEI Firmware version, MEI driver version, Gbe version etc.), and run the related MEInfo tool by using the command “MEInfoWin.exe" (under Win8.1 x86) resp. “MEInfoWin64.exe" (under Win8.1 x64)

如何enable/disable切換 讓componet可以wake up device or not

安裝win10, office2016, 然後破解啟用

$
0
0

搜尋"win10 下載"
就可以看到這篇文章 666Windows 10 台灣繁體正式版 ISO 下載 (官方/Google載點),
裡面有windows10 Pro版與Home版,
也各自有x86與x64版本!
我就是在此下載iso檔, 然後用傳統的光碟開機安裝法, 把原本系統槽 “C:" 直接刪掉重灌…

但是美中不足的, 安裝完畢後windows10表示尚未正式啟用,
雖然所有功能看起來都很正常, 但是畫面右下角會一直提醒尚未啟用, 好礙眼!
我又找一找網路, 果然有專門破解的工具
[系統工具] [軟體分享] Microsoft Windows 10 家用版/專業版(x86/x64) 市售版完美破解 [複製連結] , 我試過後成功了!

office 2016 我是在這裡找到的
免破解,微軟 Office 2016 免費下載
, 也OK!

EFI Shell commands — EDIT(全視窗編輯器) : 可用來看文字檔或log檔

$
0
0

EFI Shell commands — EDIT(全視窗編輯器)

  • Full screen editor for ASCII or UNICODE files.

EDIT [file]

  • file – Name of file to be edited

Note:

  • 1. If the file is not specified, NewFile.txt is edited.
  • 2. The size of file shall not be larger than 16 Mbytes.

Examples:

  • * To edit the ‘shell.log’ file:
  • fs0:\> edit shell.log

快速鍵:

  • “Ctrl-E" go to help, and “Ctrl-W" exit help
  • Control Key Function Key Command
    ———– ———— —————–
    Ctrl-G F1 Go To Line
    Ctrl-S F2 Save File
    Ctrl-Q F3 Exit
    Ctrl-F F4 Search
    Ctrl-R F5 Search/Replace
    Ctrl-K F6 Cut Line
    Ctrl-U F7 Paste Line
    Ctrl-O F8 Open File
    Ctrl-T F9 File Type
    ———– ———— —————–

EFI/UEFI Shell 的常用命令列表 Command list

$
0
0

EFI/UEFI Shell Command

Lists the commands supported by the EFI Shell interface on EFI/UEFI.
The EFI Shell is accessible from an nPartition console when the nPartition is in an active state but has not booted an operating system.
For details on these commands, enter help command at the EFI shell prompt.

The following categories of commands are available:
“Boot Commands — EFI Shell”.
“Configuration Commands — EFI Shell”.
“Device, Driver, and Handle Commands — EFI Shell”.
“Filesystem Commands — EFI Shell”.
“Memory Commands — EFI Shell”.
“Shell Navigation and Other Commands — EFI Shell”.
“Shell Script Commands / Programming Constructs — EFI Shell”.

Command Description
Boot Commands — EFI Shell. 

Commands related to nPartition booting. n分區啟動的相關命令

autoboot Set/view autoboot timeout variable.
bcfg Display/modify the driver/boot configuration.
boottest Set/view BootTest bits.
dbprofile Display/modify direct boot profiles for use by lanboot.
lanboot Boot over the LAN.
reconfigreset Reset the system (nPartition) for reconfiguration; the nPartition remains inactive, in the shutdown for reconfig state.
reset Reset the system (nPartition).
search Connect drivers for bootables devices.
Configuration Commands — EFI Shell. 

Commands for changing and retrieving system (nPartition) information.

acpiconfig Set/view ACPI configuration mode.
cellconfig Deconfigure/reconfigure cells. (Set cell use-on-next-boot values.)
cpuconfig Deconfigure/reconfigure processors and processor cores..
date Display the current date or set the date of the system (nPartition).
dimmconfig Deconfigure/reconfigure memory (DIMMs).
err Display/change the error level.
errdump View/clear logs.
fru View FRU data.
info Display hardware information.
monarch Set/view a monarch processor.
palproc Make a PAL call.
romdrivers Enable/disable PCI expansion ROM drivers.
rootcell Set/view preferred root cells. (Set nPartition core cell choices.)
salproc Make a SAL call.
tftp Performs TFTP operation to a bootp/DHCP enabled Unix boot server.
time Display the current time or set the time of the system (nPartition). EFI time is set and presented in GMT (Greenwich mean time).
variable Save/restore specific EFI variables.
ver Display the version information.
Device, Driver, and Handle Commands — EFI Shell. 

Commands for managing devices, drivers, and handles.

baud View serial port com settings.
connect Bind a driver to a device.
dblk Hex dump of BlkIo devices.
devices Display devices managed by EFI drivers.
devtree Display tree of devices.
dh Dump handle info.
disconnect Disconnect driver(s) from device(s).
drivers Display list of drivers.
drvcfg Invoke the Driver Config Protocol.
drvdiag Invoke the Driver Diagnostics Protocol.
guid Dump known GUID IDs.
lanaddress Display MAC address.
load Load EFI drivers.
map Map shortname to device path.
openinfo Display the open protocols for given handle.
pci Display PCI devices or PCI function configuration space.
reconnect Reconnect driver(s) from a device.
unload Unload a protocol image.
Filesystem Commands — EFI Shell. 

Commands for managing files, directories, and attributes.

attrib Display/change the attributes of files/directories.
cd Update/view the current directory.
comp Compare the contents of two files.
cp Copy one or more files/directories to another location.
edit Edit an ASCII or UNICODE file in full screen.
eficompress Compress infile and write to outfile.
efidecompress Decompress infile and write to outfile.
hexedit Edit a file, block device, or memory region using hex.
ls Display a list of files and subdirectories in a directory.
mkdir Create one or more directories.
mount Mount a filesystem on a block device.
rm Delete one or more files/directories.
setsize Set the size of a file.
touch Update time of file/directory with current time.
type Display the contents of a file.
vol Display volume information of the file system.
Memory Commands — EFI Shell. 

Commands for listing and managing memory, EFI variables, and NVRAM details.

default Set the default NVRAM values.
dmem Dump memory or memory mapped IO.
dmpstore Display all EFI variables.
memmap Display the memory map.
mm Display/modify MEM/IO/PCI.
pdt View/clear nPartition or cell memory page deallocation table (PDT).
Shell Navigation and Other Commands — EFI Shell. 

Commands for basic EFI Shell navigation and customization.

alias Set/get alias settings.
cls Clear the standard output with an optional background color.
exit Exit EFI Shell environment.
getmtc Display current monotonic counter value.
help or ? Display help.
mode Display the mode of the console output device.
set Set/Get environment variable.
xchar Turn on/off extended character features.
Shell Script Commands / Programming Constructs — EFI Shell. 

EFI shell-script commands.

echo Echo message to stdout or toggle script echo.
else Script-only: Use with IF THEN.
endfor Script-only: Delimiter for FOR loop construct.
endif Script-only: Delimiter for IF THEN construct.
for Script-only: Loop construct.
goto Script-only: Jump to label location in script.
if Script-only: IF THEN construct.
input Take user input and place in EFI variable.
pause Script-only: Prompt to quit or continue.
stall Stall the processor for some microseconds.
Viewing all 57 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>