18 lines
573 B
JavaScript
18 lines
573 B
JavaScript
const child_process = require('child_process');
|
|
const fs = require('fs');
|
|
|
|
const keyPath = 'HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Cryptography';
|
|
|
|
child_process.exec(`REG QUERY ${keyPath} /v MachineGuid`,function(error,stdout,stderr){
|
|
console.log('stderr:'+stderr);
|
|
if(error != null){
|
|
console.log('exec error:'+error);
|
|
return
|
|
}
|
|
fs.writeFile('./MachineGuid.txt', stdout.slice(83,119), (error) => {
|
|
if(error){
|
|
console.log(`创建失败:${error}`);
|
|
}
|
|
console.log(`创建成功!`);
|
|
});
|
|
}); |