本文目录导读:

这里给你几个实用的脚本方案,从简单到进阶,按需选择:
Windows 批处理(最简单)
创建一个 .bat 文件,用 start 命令打开多个文件夹:
@echo off echo 正在打开常用文件夹... start "" "C:\Users\你的用户名\Desktop" REM 桌面 start "" "D:\Projects" REM 项目目录 start "" "C:\Users\你的用户名\Downloads" REM 下载 start "" "D:\Documents" REM 文档 echo 完成! timeout /t 2
用法:保存为 open_common.bat,双击运行。
PowerShell 脚本(更灵活)
# 定义常用文件夹列表(数组)
$folders = @(
"C:\Users\你的用户名\Desktop",
"D:\Projects",
"C:\Users\你的用户名\Downloads",
"D:\Documents",
"\\192.168.1.100\共享文件夹" # 网络路径也可以
)
# 循环打开
foreach ($folder in $folders) {
if (Test-Path $folder) {
Write-Host "打开: $folder" -ForegroundColor Green
Start-Process explorer.exe $folder
} else {
Write-Host "路径不存在: $folder" -ForegroundColor Red
}
}
Write-Host "全部打开完成!" -ForegroundColor Cyan
用法:保存为 .ps1 文件,右键“使用 PowerShell 运行”。
Python 脚本(跨平台)
import os
import subprocess
import platform
# 定义文件夹列表
folders = [
os.path.expanduser("~/Desktop"),
os.path.expanduser("~/Downloads"),
"D:/Projects",
"D:/Documents"
]
def open_folder(path):
if os.path.exists(path):
if platform.system() == "Windows":
subprocess.run(['explorer', path])
elif platform.system() == "Darwin": # macOS
subprocess.run(['open', path])
else: # Linux
subprocess.run(['xdg-open', path])
print(f"✓ 已打开: {path}")
else:
print(f"✗ 路径不存在: {path}")
# 逐个打开
for folder in folders:
open_folder(folder)
保存为 open_folders.py,运行:python open_folders.py
带菜单的交互式脚本(推荐)
@echo off
chcp 65001 >nul快速打开文件夹工具
color 0A
:menu
cls
echo ==================================
echo 快速打开文件夹工具
echo ==================================
echo 1. 桌面
echo 2. 下载
echo 3. 项目
echo 4. 文档
echo 5. 全部打开
echo 0. 退出
echo ==================================
set /p choice="请选择: "
if "%choice%"=="1" start "" "%USERPROFILE%\Desktop" & goto menu
if "%choice%"=="2" start "" "%USERPROFILE%\Downloads" & goto menu
if "%choice%"=="3" start "" "D:\Projects" & goto menu
if "%choice%"=="4" start "" "D:\Documents" & goto menu
if "%choice%"=="5" (
start "" "%USERPROFILE%\Desktop"
start "" "%USERPROFILE%\Downloads"
start "" "D:\Projects"
start "" "D:\Documents"
echo 已全部打开!
timeout /t 2
goto menu
)
if "%choice%"=="0" exit
echo 无效选择,请重新输入!
timeout /t 2
goto menu
快捷热键版(高级)
用 AutoHotkey 创建热键脚本:
; 热键:Win+1 打开桌面,Win+2 打开下载...
#1:: Run explorer.exe %USERPROFILE%\Desktop
#2:: Run explorer.exe %USERPROFILE%\Downloads
#3:: Run explorer.exe D:\Projects
#4:: Run explorer.exe D:\Documents
; Win+A 全部打开
#a::
Run explorer.exe %USERPROFILE%\Desktop
Run explorer.exe %USERPROFILE%\Downloads
Run explorer.exe D:\Projects
Run explorer.exe D:\Documents
return
使用技巧建议
- 快捷键方式:把脚本固定到任务栏或创建桌面快捷方式
- 开机自动启动:将快捷方式放到
shell:startup文件夹 - 便携版:用绿色软件如 Everything 配合使用
- 自动化进阶:可以考虑用 PowerToys Run 或 Flow Launcher 的自定义动作
推荐:日常使用用 方案四 的批处理菜单版,简单实用;如果经常需要快捷键操作,方案五 的 AutoHotkey 体验最好。
记得修改脚本里的路径为你自己的实际路径!