::参考内存盘软件https://download.csdn.net/download/zly6tz/9717137
cls
@echo off ::内存虚拟盘符-内存盘大小自己查看源目录大小
::下面是设置vs2008,vs插件VisualAssist,chrome,我设置的是8G,目前使用了2.3g
::此内存盘需要设置对应文件-开机时加载,关机保存即可
@SET VDisk=S: echo 正在努力工作... ::下面的项 自己按需修改 call :SRCopyMKLink "C:\Program Files (x86)\Microsoft Visual Studio 9.0\Common7" "%VDisk%\vs.Common7" call :SRCopyMKLink "C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC" "%VDisk%\vs.VC" call :SRCopyMKLink "C:\Users\Administrator\AppData\Roaming\Microsoft\VisualStudio\9.0" "%VDisk%\vs.Roaming" call :SRCopyMKLink "C:\Users\Administrator\AppData\Local\VisualAssist" "%VDisk%\VisualAssist" call :SRCopyMKLink "C:\Users\Administrator\AppData\Local\Google\Chrome" "%VDisk%\Chrome" @goto end ::自动备份目录 并联接
:SRCopyMKLink
@set srcDir=%~1
@set toDir=%~2
@SET srcName=%~nx1
@SET toName=%~nx2 ::变态的bat,函数中的if exist路径包含括号时出鬼,只能用cd来处理
cd /d "%~dp1" if not exist %srcName%_SRBAK (
::判断源路径是否存在
if not exist "%srcName%" (
echo 源目录不存在:%srcName%
goto toerror
) rename "%srcName%" "%srcName%_SRBAK"
if not exist "%srcName%_SRBAK" (
echo 修改源目录名失败:%srcName%
goto toerror
)
) ::处理目标路径
if not exist "%toDir%" ( ::创建一个临时目录
md "%toDir%_tmp" xcopy "%srcName%_SRBAK\*.*" "%toDir%_tmp\" /s /e /y /h /r /Q
if not %errorlevel%==0 (
echo 复制文件失败:源:%srcName%
goto toerror
) ::将临时目录名修改回来
ren "%toDir%_tmp" "%toName%"
if not exist "%toDir%" (
echo 修改目标路径失败:%srcName%
goto toerror
)
) if exist "%srcName%_SRBAK" ( if exist "%srcName%" (
::删除源目录名
rd /s /q %srcName%
if exist "%srcName%" (
echo 删除源链接失败:%srcName%
goto toerror
)
) mklink /j "%srcName%" "%toDir%"
if not %errorlevel%==0 (
echo 链接失败:%srcName%
goto toerror
)
) :tosuccess
@exit /B 0
:toerror
echo 发生了错误
@exit /B 1 :end
pause

最新文章

  1. linux vi 命令大全
  2. simple mail example for smtp debug
  3. Redis中struct运用
  4. ArrayList实现线程的几种方法
  5. adb shell 命令详解(转)
  6. Spring(3.2.3) - Beans(6): 作用域
  7. swift-03-数据类型转换
  8. Block 代替for循环
  9. 在Windows环境下部署Axis2/C服务
  10. Nginx上部署HTTPS
  11. Ansible@一个高效的配置管理工具--Ansible configure management--翻译(一)
  12. PHP开发小技巧,让你瞬间提升逼格
  13. centos/linux下的安装Nginx
  14. springmvc源码分析——入门看springmvc的加载过程
  15. linux shell必知必会sed、awk
  16. Linux 如何通过命令查看一个文件的某几行(中间几行或最后几行)
  17. 洛谷P3516 PRZ-Shift [POI2011] 构造
  18. 理解 Python 的执行方式,与字节码 bytecode 玩耍 (下)
  19. Component 初识组件
  20. Java:基本数据类型与类型转换

热门文章

  1. CSS 样式属性
  2. C# Windows程序窗口置前台的几种方法
  3. Failed to unregister the JMX name: org.apache.commons.dbcp2:name=xxx,type=BasicDataSource
  4. springboot自定义banner生成器
  5. 输出字符串中最长的单词 C# 算法
  6. 关于DDL、DML和DCL的区别与理解
  7. Zookeeper简单初应用
  8. MBTIles实现
  9. 位图和SVG用法比较
  10. JSP内置对象——application对象