【问题标题】:How to do BATCH file complete directory copy and find the user temporary directory?如何进行 BATCH 文件完整目录复制并找到用户临时目录?
【发布时间】:2011-12-31 18:53:30
【问题描述】:

如何在 Windows 中执行此操作?例如:cp -R /tmp /var/tmp

: How to copy?
: cp -R this /var/tmp?
set temp=%USERPROFILE%
echo %temp%
copy thisWholeDirectoryIncludingSub/*.* %temp%

【问题讨论】:

标签: windows windows-7 batch-file


【解决方案1】:

我将xcopy/e 一起使用:“复制目录和子目录,包括空目录。”

您可能还想要/h:“也复制隐藏文件和系统文件。”

xcopy thisWholeDirectoryIncludingSub %temp% /e /h

【讨论】:

  • 太棒了。但我试图得到的是像java中这样的临时目录,我可以拥有 System.getenv("TEMP");我如何使用 BATCH 获得类似的结果?
  • @Google - 使用%envVar% 语法,就像您所做的那样:%temp%。 (只是不要先覆盖temp,因为它应该已经默认存在了。)
猜你喜欢
  • 1970-01-01
  • 2018-05-21
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2010-09-07
  • 1970-01-01
  • 2016-03-14
相关资源
最近更新 更多