我正在嘗試創建一個管理工具HTA。這比其他任何東西都更適合學習。到目前爲止,我已經在這裏找到了我需要的一切。現在我被困在一塊。我想收集計算機的序列號並將其輸出到文本框或文本區中。這是我正在嘗試使用的代碼。正如代碼將輸出「serialnumber」到文本框。任何幫助將不勝感激。如何使用HTA獲取計算機序列號
sub ComputerS
set objExec = objShell.Exec("wmic bios get serialnumber")
Set objStdOut = objExec.StdOut
strLine = objStdOut.ReadLine
queryResults.value = strLine
end Sub
,這裏是爲texarea和按鈕
<input type="button" value="Serial" onClick="ComputerS">
<textarea name="queryResults" rows="5" cols="30"></textarea>
所以我想它的代碼。我不得不添加一行代碼
sub ComputerS
set objExec = objShell.Exec("wmic bios get serialnumber")
Set objStdOut = objExec.StdOut
objExec.StdOut.skipLine
strLine = objStdOut.ReadLine
queryResults.value = strLine
end Sub
當我添加skipLine它的工作完美。 感謝大家的幫助,當我在我的工具上展開時,我一定會在不久的將來使用您的信息。