const command = `select volume ${diskmounted}
format label="${newName}" quick`
fs.writeFile('a-path/scriptname.txt', command, (err) => {
if (err) throw err;
});
try {
exec('diskpart /s a-path\\scriptname.txt', (error: Error, stdout: any, stderr: any) => {
if (error) {
console.log(`error with cmd : ${error}`)
}
if (stdout) {
console.log(`out of the command : ${stdout}`)
}
if (stderr) {
console.log(`error with cmd : ${stderr}`)
return;
}
});
} catch {
console.log('error with cmd: cmd dosent launch')
}