Files
notes/resource/工具/obsidian/scripts/openTerminal.js
T
Docker7530 a2f5df43cc 1772367588
2026-03-01 20:20:04 +08:00

22 lines
631 B
JavaScript

module.exports = async (params) => {
const { app } = params;
// 获取当前仓库路径
const vaultPath = app.vault.adapter.basePath;
// 构建 Windows Terminal 命令
const command = `wt -d "${vaultPath}"`;
// 使用 Node.js child_process 执行命令
const { exec } = require('child_process');
exec(command, (error, stdout, stderr) => {
if (error) {
console.error('执行失败:', error);
new Notice('无法打开终端');
return;
}
console.log('终端已打开');
});
};