我输入为
var = primarynode.domain.local
而现在我只需要primarynode它.
我正在寻找拆分和令牌化,但无法在一个行代码中执行此操作.有谁知道如何在一个行代码中做到这一点?
我有最后一次从 WMI 启动的时间,它看起来像“20141103113859.220250+060”。我想将其转换为当前时间的天数和时间。
是否可以?
我只对“DelayedAutoStart”键的值感兴趣,并希望此代码能够工作,但它会打印更多信息。有人能告诉我这里有什么问题吗?
use Win32::Registry;
use Data::Dumper;
$p = "SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion";
$p = "SYSTEM\\CurrentControlSet\\Services\\sppsvc";
$main::HKEY_LOCAL_MACHINE->Open($p, $CurrVer) ||
die "Open: $!";
$CurrVer->GetValues(\%vals);
#print Dumper(\%vals);
foreach $k (keys %vals) {
$key = $vals{$k};
if ($$key[0] == "DelayedAutoStart")
{
print "$$key[0] = $$key[2]\n";
}
}
Run Code Online (Sandbox Code Playgroud)
结果:
ServiceSidType = 1
ErrorControl = 1
LaunchProtected = 1
DisplayName = @%SystemRoot%\system32\sppsvc.exe,-101
Start = 2
ImagePath = %SystemRoot%\system32\sppsvc.exe
Description = @%SystemRoot%\system32\sppsvc.exe,-100
DelayedAutoStart = 1
ObjectName = NT AUTHORITY\NetworkService
RequiredPrivileges = SeAuditPrivilege SeChangeNotifyPrivilege
SeCreateGlobalPrivilege SeImpersonatePrivilege
FailureActions = ÇQ? ? ¶ …Run Code Online (Sandbox Code Playgroud)