Commit 308ed794 authored by Ahmad's avatar Ahmad

inikt

parent c3665d55
@echo off
title Running Node.js Clr
echo Starting Node.js Create...
cd /d "%~dp0" // Ensures the script runs from the directory where the batch file is located
node clr.js // Runs your Node.js application
pause // Keeps the command prompt open after the script finishes
const fs = require('fs');
const path = require('path');
const { exec } = require('child_process');
// Function to clear Downloads folder
function clearDownloadsFolder() {
const downloadsPath = path.join(process.env.HOMEPATH, 'Downloads');
fs.readdir(downloadsPath, (err, files) => {
if (err) {
console.error('Error reading Downloads folder:', err);
return;
}
files.forEach((file) => {
const filePath = path.join(downloadsPath, file);
fs.unlink(filePath, (err) => {
if (err) {
console.error(`Failed to delete ${file}:`, err);
} else {
console.log(`Deleted: ${file}`);
}
});
});
});
}
// Function to close incognito Firefox
function closeIncognitoFirefox() {
exec('tasklist', (err, stdout) => {
if (err) {
console.error('Error listing tasks:', err);
return;
}
const firefoxProcesses = stdout
.split('\n')
.filter(line => line.includes('firefox.exe'));
if (firefoxProcesses.length > 0) {
exec('taskkill /IM firefox.exe /F', (err) => {
if (err) {
console.error('Error closing Firefox:', err);
} else {
console.log('Closed Firefox incognito windows');
}
});
} else {
console.log('No Firefox processes running');
}
});
}
// Run the functions
clearDownloadsFolder();
closeIncognitoFirefox();
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment