如何通过命令行访问共享文件夹 [英] How to access a shared folder via command line

查看:1539
本文介绍了如何通过命令行访问共享文件夹的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在Windows7命令行中建立并保存连接到我的工作网络共享文件夹?

How do I establish and save a connection in Windows7 command line to my work network shared folder?

推荐答案

使用以下内容:

Use the following :
net use p: \\servername\sharename /persistant:yes





其中p :是要映射到的驱动器号。



Where p: is the drive letter you want to map to.


问题的根源:

我正在使用Microsoft Access数据库我的应用程序中的数据存储。

该应用程序需要一小组客户端来访问(RD / WR)数据库。

客户端位于本地网络中。

该集合是为了存储数据库文件(即database.accdb)的服务器机器。

我使用的是Microsoft.ACE.OLEDB.12.0供应商!提供商没有服务http网址的功能! (所以数据源= http:// host /是不允许的)。

ACE提供者只能访问本地路径中的数据库文件。

所以我是必需的映射我的数据库所在的驱动器(服务器硬盘驱动器)。

另一个条件是所有机器必须在同一网络上(即家庭组或工作)。

A解决方案:

1)自动映射驱动器并分配驱动器名称,例如X:,Z:,R:!

2)将所有客户端机器连接到同一网络(即工作网络)

3)使用批处理文件并在应用程序加载时启动进程。

那么批处理文件中有什么?

4)必须共享服务器的硬盘!

可以映射驱动器并使用以下命令



Source of the problem:
I am using a Microsoft Access DB for the data store in my application.
The application requires a small group of clients to access(RD/WR) the database.
The clients are within a local network.
The set is so that there is a server machine on which the database file (ie database.accdb) is stored.
I am using the Microsoft.ACE.OLEDB.12.0 Provider! the provider does not have functionality of servicing http urls! (so the data source=http://host/ is not allowed).
The ACE provider can only access the database file within local paths.
So i was required to map the drive(the server HDD) on which my database is living.
another condition is that all machines must be on the same network(ie, homegroup or work).
A Solution:
1)map the drive automatically and assign a drive name such as X:, Z:, R:!
2)have all the client machines to be connected to the same network (i,e Work network)
3)use a a batch file and start a process on application load.
So what is in the batch file?
4) the HDD of the server must be shared!
it is possible to map a drive and log on to it using the follwing command

net use X: \\192.168.1.X\sharename {password} /USER:username /P:yes





以上解释:



explanations of the above:

net use

是连接到本地驱动器的命令

is the command to connect to a local drive

X:

这可以是任意字母,后跟半冒号。只要正在运行批处理的机器没有使用此驱动器号!

this can be any letter followed by a semi colon. as long as the machine on which the batch is being run does not have this drive letter in use!

\\ip

这是服务器的静态IP或者可以是机器名称(windows机器名称)

this is the static ip of the server or can be the machine name(windows machine name)

\share-name

这是该位置的名称在服务器上共享。设置共享的用户将分配此名称

this is the name of the location being shared on the server machine. user who sets up sharing will assign this name

{password}

完整突出显示的术语(即包括大括号)是服务器机器的密码

the complete highlighted term (ie including the braces) is the password to the server machine

/USER:username

用户名由服务器机器的用户名替换。

the username is replaced by the user name of the server machine.

/P:yes

这意味着此连接是持久的。这将使客户端计算机处于打开状态的连接保持连接状态,并在重新启动时断开连接!



更多详细信息:

通过在VB.net中使用如下命令运行批处理文件

process.start(C:\ folder \ connect.bat)

应用程序加载事件

我们可以欺骗我们登录服务器并获取对数据库文件的访问权限。但是当然应该动态地跟踪数据库的路径。(我不会在这里讨论!)

this means that this connection is persistent. this will keep the connection live for the duration of which the client machine is on and will disconnect with a reboot!.

further details:
By having the batch file to run with a command such as this in VB.net
process.start("C:\folder\connect.bat")
on the event of application load
we can cheat our way of logging in to the server and gain access to the database file. but of course one should keep track of the path to the database dynamically.(i will not get into the ways here!)


这篇关于如何通过命令行访问共享文件夹的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆