
javascript
// 导入所需的库
const { exec } = require('child_process');
// 插件列表
const pluginList = [
'plugin1.crx',
'plugin2.crx',
'plugin3.crx',
// 更多插件...
];
// 遍历插件列表并安装插件
for (const plugin of pluginList) {
const installCommand = `chrome.exe --user-data-dir=${__dirname}/extensions/${plugin} ${plugin}`;
exec(installCommand, (error, stdout, stderr) => {
if (error) {
console.error(`Error installing plugin: ${error}`);
} else if (stderr) {
console.error(`Stderr: ${stderr}`);
} else {
console.log(`Successfully installed plugin: ${plugin}`);
}
});
}
请注意,这个脚本假设你已经在Google Chrome浏览器的扩展程序文件夹中创建了一个名为"extensions"的文件夹。在这个文件夹中,你需要将每个插件的CRX文件(Chrome扩展程序的可执行文件)放在其中。
此外,这个脚本使用了Node.js的`child_process`模块来执行命令行指令。如果你没有安装Node.js,你需要先安装它才能运行这个脚本。你可以通过访问Node.js官网(https://nodejs.org/)来下载和安装Node.js。