Chinaunix

标题: 备 份 注 册 表 项的问题 [打印本页]

作者: perlw01f    时间: 2010-11-25 09:43
标题: 备 份 注 册 表 项的问题
本帖最后由 perlw01f 于 2010-11-25 09:45 编辑
  1. #!/usr/bin/perl
  2. use strict;
  3. use warnings;
  4. use Win32::Registry;
  5. my $Register = "SYSTEM\\CurrentControlSet\\Control\\Citrix";
  6. my $hkey;
  7. $::HKEY_LOCAL_MACHINE->Open($Register, $hkey)|| die $!;
  8. $hkey->Save('c:\test1.reg');
  9. $hkey->Close();
复制代码
得到的文件 8Kb 且不是正常的 reg文件格式
从 Citrix export得到的reg文件 1Kb
Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Citrix]

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Citrix\wfshell]

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Citrix\wfshell\TWI]
"LogoffCheckSysModules"="acrotray.exe,acrodist.exe,Acrobat.exe"


请 教 如何 得到 后面的这种格式?
谢 谢
作者: perlw01f    时间: 2010-11-25 09:53
本帖最后由 perlw01f 于 2010-11-25 10:06 编辑

怪异
http://search.cpan.org/~jdb/Win32-Registry-0.10/Registry.pm 没有export方法

但是这个
http://jenda.krynicky.cz/perl/Registry.pm.html居然有export方法。。。

Export

     $obj->Export( [$filename, [$continuation]] )

    Export the key into a registry script (.REG) file. This method creates a standard registry script, the same you get when you export a key from Regedit.exe.

    If you do not specify the $filename, the text gets printed to the currently select()ed filehandle.

    If the $continuation is defined, no header is printed out. You may use this to export several keys into one file.

    If you do not want to specify the filename, but need continuation, use undef() as the $filename.

本机试用 export
Can't locate auto/Win32/Registry/Export.al in @INC (@INC contains: C:\ C:/Perl/site/lib C:/Perl/lib .) at C:\Users\UserA\AppData\Local\Temp\dir108E.tmp\test1.pl


继续求助中。。。
作者: zhlong8    时间: 2010-11-25 10:14
本帖最后由 zhlong8 于 2010-11-25 10:26 编辑

少个文件或模块 /Win32/Registry/Export.pm 应该

CPAN能找到下面那个吗?你装的是下面那个吗, ActivePerl 中是 0.10 版的没这个方法
作者: perlw01f    时间: 2010-11-25 10:33
cpan那个没有。。。




欢迎光临 Chinaunix (http://bbs.chinaunix.net/) Powered by Discuz! X3.2