- 论坛徽章:
- 0
|
原帖由 nmxdf 于 2006-9-6 15:33 发表
我要在脚本中启动mssql2000 服务,
在命令:
sc start mssql
system($ENV{'SystemRoot'}/sc.exe start mssql) 可以吗
Hi,
yes. you can do that with system(PROGRAMM, LIST).
TIPS:
If sc.exe is includeed in executable path, you can ommit the absolute path,
otherwise you must add ABSOLUT_PATH_TO/sc.exe.
The arguments or parameter "start" "mssql" should be placed in LIST.
For example:
open a hosts file with notepad:
perl -e "system(notepad, 'C:\WINNT\system32\drivers\etc\hosts');"
To better control of windows services, you can use CPAN module Win32::Service.
pls ref. to the docs.
For example to get all services from given host:
- use strict;
- use Data::Dumper;
- use Win32::Service;
- my $host = "YOUR_HOSTNAME";
- my $href = {};
- my $ws = Win32::Service::GetServices($host, $href);
- # dumper all services name
- print Dumper($href);
复制代码
regards, ulmer |
|