开发者

Create folders on a remote Windows PC using C++?

How can I create folders on a remo开发者_运维百科te Windows PC using C++?


Directly, you can't -- there would have to be a service on the remote machine which exposes that functionality for you.

If you're talking about a server message block scenario (i.e. "Windows Filesharing"), you can just call CreateDirectory with a network path, i.e. "\\\\computername\\share\\newFolder", but this requires the remote machine already be setup with an existing network share (I don't believe you can create said share remotely without A. admin rights on the target box, and B. some lessening of security settings to allow creation of shares remotely).

EDIT: (In response to the tag edit adding the MFC tag)
As far as how CreateDirectory is exposed in MFC, I'm not sure if there's an MFC wrapper around that function at all -- though there really doesn't need to be a wrapper because the function itself is self contained -- there'd be no benefit of putting it in a class.


The typical way is to start by calling NetShareAdd to create a share to a path on the remote machine. To support creating things there, you'll normally want to specify at least ACCESS_CREATE for the share.

Once you've done that, you'll have a local path to the remote disk, and you can create a directory in it, just like you would with a local disk.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜