【问题标题】:Moving file using cmd? [closed]使用cmd移动文件? [关闭]
【发布时间】:2017-08-30 05:29:20
【问题描述】:

我有一个从 Google 下载的文件(位于下载文件夹中) 我想将它移动到自动运行文件夹(计算机打开时文件运行的文件夹)。

我需要使用 cmd 命令移动文件(原因是它将使用 USB 橡皮鸭来完成。 如果有帮助,我正在使用 Windows 10 64 位。

文件所在的路径

C:\Users\%USERPROFILE%\Downloads\Test.exe

我想把它移到的路径是

C:\Users\%USERPROFILE%\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup

%USERPROFILE% 的原因是它应该适用于所有计算机。

【问题讨论】:

  • rubberduck 标签与此无关。请在使用前阅读标签说明。
  • 有一个move 命令...
  • 为什么适用于所有计算机的通用解决方案将最近下载的文件移动到 Autorun 听起来像恶意软件/病毒?

标签: batch-file cmd window


【解决方案1】:

要移动文件,请使用move 命令。

move "%USERPROFILE%\Downloads\Test.exe" "%USERPROFILE%\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup"

我会在源和目标周围加上引号,以防您是其中的一员,由于某种原因在其用户名中有空格(并且目标无论如何都需要它们用于“开始菜单”中的空格)。

来自move /?的输出:

Moves files and renames files and directories.

To move one or more files:
MOVE [/Y | /-Y] [drive:][path]filename1[,...] destination

  [drive:][path]filename1 Specifies the location and name of the file
                          or files you want to move.
  destination             Specifies the new location of the file. Destination
                          can consist of a drive letter and colon, a
                          directory name, or a combination. If you are moving
                          only one file, you can also include a filename if
                          you want to rename the file when you move it.
  [drive:][path]dirname1  Specifies the directory you want to rename.
  dirname2                Specifies the new name of the directory.

  /Y                      Suppresses prompting to confirm you want to
                          overwrite an existing destination file.
  /-Y                     Causes prompting to confirm you want to overwrite
                          an existing destination file.

【讨论】:

  • 谢谢它的工作
  • 不知道为什么我被否决了,但是好吧...
  • 它的工作,感谢您的帮助@SomethingDark
【解决方案2】:

要移动文件使用 mv,但如果您不使用 admin 则无法使用,如何破解,请尝试 windows 的超级用户工具!

【讨论】:

  • 我是英文菜鸟
  • Windows 没有命令 mv(在 PowerShell 中作为别名除外)。该问题被标记为 vbscript 和批处理文件。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2023-03-13
相关资源
最近更新 更多