您的位置:首页 > 其它

使用psexec共享远程文件夹

2011-06-13 10:12 260 查看
Windows可以使用net share命令来共享文件。为了方便共享服务器中的文件夹,而不需要远程桌面登录后才可以设置,这里使用了SysinternalsSuite中的psexec.exe来实现远程直接共享。

一、共享命令

net share

用于以命令行方式管理共享.

语法:

net share <sharename>=<drive>:\<directory>[/users=<number> or /unlimited] [/remark:"text"]
net share <sharename> [/users=<number> or /unlimited][/remark:"text"]
net share <sharename or device name or drive and path> /delete

选项:

<sharename> 共享名
<device name> 指定打印机共享中的打印机名
<drive>:<path> 绝对路径
/users:<number> 同时连接到一个共享的连接数
/unlimited 不限制使用
/remark:"<text>" 对共享的说明
/delete 删除指定的共享


 

二、psexec远程执行

PsExec executes a program on a remote system, where remotely executed console

applications execute interactively.

Usage: psexec [\\computer[,computer2[,...] | @file][-u user [-p psswd]][-n s][-l

][-s|-e][-x][-i [session]][-c [-f|-v]][-w directory][-d][-<priority>][-a n,n,...

] cmd [arguments]

     -a         Separate processors on which the application can run with

                commas where 1 is the lowest numbered CPU. For example,

                to run the application on CPU 2 and CPU 4, enter:

                "-a 2,4"

     -c         Copy the specified program to the remote system for

                execution. If you omit this option the application

                must be in the system path on the remote system.

     -d         Don't wait for process to terminate (non-interactive).

     -e         Does not load the specified account's profile.

     -f         Copy the specified program even if the file already

                exists on the remote system.

     -i         Run the program so that it interacts with the desktop of the

                specified session on the remote system. If no session is

                specified the process runs in the console session.

     -l         Run process as limited user (strips the Administrators group

                and allows only privileges assigned to the Users group).

                On Windows Vista the process runs with Low Integrity.

     -n         Specifies timeout in seconds connecting to remote computers.

     -p         Specifies optional password for user name. If you omit this

                you will be prompted to enter a hidden password.

     -s         Run the remote process in the System account.

     -u         Specifies optional user name for login to remote

                computer.

     -v         Copy the specified file only if it has a higher version number

                or is newer on than the one on the remote system.

     -w         Set the working directory of the process (relative to

                remote computer).

     -x         Display the UI on the Winlogon secure desktop (local system

                only).

     -priority  Specifies -low, -belownormal, -abovenormal, -high or

                -realtime to run the process at a different priority. Use

                -background to run at low memory and I/O priority on Vista.

     computer   Direct PsExec to run the application on the remote

                computer or computers specified. If you omit the computer

                name PsExec runs the application on the local system,

                and if you specify a wildcard (\\*), PsExec runs the

                command on all computers in the current domain.

     @file      PsExec will execute the command on each of the computers listed

                in the file.

     program    Name of application to execute.

     arguments  Arguments to pass (note that file paths must be

                absolute paths on the target system).

 

psexec可以在远程机器上执行命令,下面是执行的命令

D:\Documents and Settings\huqunhui\psexec.exe \

\xxx.xxx.xxx.xxx -u username -p password net share my=I:\T2 /unlimited
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: