在windows中,如何将文件夹挂载为驱动器

Ian*_*ing 33 windows mount

我有一些文件夹,比如 C:\foo 我想挂载为驱动器 M:\

在 linux 中,我会使用绑定安装来完成此操作。

Dou*_*xem 50

您可以在 Windows 中使用subst命令。

subst m: c:\foo
Run Code Online (Sandbox Code Playgroud)

要进行持久重定向,您可以编辑注册表。将字符串 (REG_SZ) 值添加到:

HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\DOS Devices
Run Code Online (Sandbox Code Playgroud)

将值的名称设置为驱动器号(例如M:),然后将数据设置为:

\??\C:\foo\foosub
Run Code Online (Sandbox Code Playgroud)

此方法适用于登​​录和重新启动。我在 Windows 2008 上对此进行了测试,因此它也应该适用于 Vista、XP、2003 和 2000。

  • 我添加了另一种持久的方法。 (2认同)

小智 7

Subst 也适用于 Vista:

C:\Users\juan>subst /?
Associates a path with a drive letter.

SUBST [drive1: [drive2:]path]
SUBST drive1: /D

  drive1:        Specifies a virtual drive to which you want to assign a path.
  [drive2:]path  Specifies a physical drive and path you want to assign to
                 a virtual drive.
  /D             Deletes a substituted (virtual) drive.

Type SUBST with no parameters to display a list of current virtual drives
Run Code Online (Sandbox Code Playgroud)

.


squ*_*man 5

  • 右键单击该文件夹并选择共享和安全
  • 选择共享此文件夹
  • 给它一个共享名称(例如- myshare)
  • 点击确定

将驱动器 (M:) 映射到 \\yourcomputername\myshare