This commit is contained in:
熊潇 2025-05-20 23:58:29 +08:00
commit 1970b81639
4 changed files with 57 additions and 0 deletions

1
.gitignore vendored Normal file
View File

@ -0,0 +1 @@
node_modules

17
package.json Normal file
View File

@ -0,0 +1,17 @@
{
"name": "auto-install-tools",
"version": "0.0.1",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"keywords": [],
"author": "abearxiong <xiongxiao@xiongxiao.me> (https://www.xiongxiao.me)",
"license": "MIT",
"packageManager": "pnpm@10.6.2",
"type": "module",
"devDependencies": {
"@types/node": "^22.15.19"
}
}

29
pnpm-lock.yaml generated Normal file
View File

@ -0,0 +1,29 @@
lockfileVersion: '9.0'
settings:
autoInstallPeers: true
excludeLinksFromLockfile: false
importers:
.:
devDependencies:
'@types/node':
specifier: ^22.15.19
version: 22.15.19
packages:
'@types/node@22.15.19':
resolution: {integrity: sha512-3vMNr4TzNQyjHcRZadojpRaD9Ofr6LsonZAoQ+HMUa/9ORTPoxVIw0e0mpqWpdjj8xybyCM+oKOUH2vwFu/oEw==}
undici-types@6.21.0:
resolution: {integrity: sha512-iwDZqg0QAGrg9Rav5H4n0M64c3mkR59cJ6wQp+7C4nI0gsmExaedaYLNO44eT4AtBBwjbTiGPMlt2Md0T9H9JQ==}
snapshots:
'@types/node@22.15.19':
dependencies:
undici-types: 6.21.0
undici-types@6.21.0: {}

View File

@ -0,0 +1,10 @@
import { exec } from 'node:child_process';
export function isAdmin() {
return new Promise((resolve) => {
exec('net session', (error) => {
// 如果 `net session` 执行成功(无 error则是管理员
resolve(error === null);
});
});
}