Page 1 of 1 1
Topic Options
#163316 - 2006-06-16 12:22 PM Supress Output of an REG IMPORT-Command
Luziekix Offline
Getting the hang of it

Registered: 2003-02-27
Posts: 68
Hi,

I want to use somewhat like this to import settings into the registry
from a .REG-File on a Windows XP or Win2000-Client (with REG.EXE from XP):

Code:
$cmd="reg import \\DOMAIN-DC\NETLOGON\SET-ORIG.reg"
SHELL $cmd


-> This displays me: "Command successfully".

If I want to surpress this message I can use on the Windows-CMD-Processor:

reg import reg import \\DOMAIN-DC\NETLOGON\SET-ORIG.reg > NUL
This works fine.

But this in a KIX-Script WON´T work:
Code:
$cmd="reg import \\DOMAIN-DC\NETLOGON\SET-ORIG.reg > NUL"
SHELL $cmd


-> This displays me: "Error: To many commandline parameters".

I´ve tried several things like:
Code:
$cmd='reg import \\DOMAIN-DC\NETLOGON\SET-ORIG.reg >NUL: 2>NUL:'
SHELL $cmd


but this display also: "Error: To many commandline parameters".

Anyone having a tip how I can import from a .REG-File without having
any message on the screen ?!

Regards,

Luziekix

Top
#163317 - 2006-06-16 12:47 PM Re: Supress Output of an REG IMPORT-Command
Björn Offline
Korg Regular
*****

Registered: 2005-12-07
Posts: 953
Loc: Stockholm, Sweden.
why don't you just use the commands within kix for adding keys/values?
_________________________
as long as it works - why fix it?
If it doesn't work - kix-it!

Top
#163318 - 2006-06-16 12:55 PM Re: Supress Output of an REG IMPORT-Command
Luziekix Offline
Getting the hang of it

Registered: 2003-02-27
Posts: 68
> why don't you just use the commands within kix for adding keys/values?

Because .REG-Files are much easier to handle for me,
as I will set a huge bunch of Registry Keys with them.
Not only some single values.

Maybe someone has a clue for my situation :-)

Luziekix

Top
#163319 - 2006-06-16 01:00 PM Re: Supress Output of an REG IMPORT-Command
Björn Offline
Korg Regular
*****

Registered: 2005-12-07
Posts: 953
Loc: Stockholm, Sweden.
If you plan to use a bunch of reg-files, perhaps a udf would benefit the silent part better, dunno. but try:
Code:

$cmd="reg import \\DOMAIN-DC\NETLOGON\SET-ORIG.reg"
SHELL $cmd > NUL

_________________________
as long as it works - why fix it?
If it doesn't work - kix-it!

Top
#163320 - 2006-06-16 01:21 PM Re: Supress Output of an REG IMPORT-Command
Mart Moderator Offline
KiX Supporter
*****

Registered: 2002-03-27
Posts: 4673
Loc: The Netherlands
There already is a UDF for importing reg files.
Have a look at ImportRegFile - Imports .Reg files to registry same way as "regedit /s"
_________________________
Mart

- Chuck Norris once sold ebay to ebay on ebay.

Top
#163321 - 2006-06-16 01:26 PM Re: Supress Output of an REG IMPORT-Command
Björn Offline
Korg Regular
*****

Registered: 2005-12-07
Posts: 953
Loc: Stockholm, Sweden.
lol. It's now that you'll have to love Mart =)
And Mart, thanks for saving me from the curiosity and needing of writing my own
_________________________
as long as it works - why fix it?
If it doesn't work - kix-it!

Top
#163322 - 2006-06-16 01:29 PM Re: Supress Output of an REG IMPORT-Command
Luziekix Offline
Getting the hang of it

Registered: 2003-02-27
Posts: 68
@Björn:

> SHELL $cmd > NUL

This don´t work. No message but also imports nothing...

@Mart:

OK, I´ll try the UDF you suggested. Thanks !

Luziekix

Top
#163323 - 2006-06-16 01:43 PM Re: Supress Output of an REG IMPORT-Command
Mart Moderator Offline
KiX Supporter
*****

Registered: 2002-03-27
Posts: 4673
Loc: The Netherlands
Quote:

lol. It's now that you'll have to love Mart =)
And Mart, thanks for saving me from the curiosity and needing of writing my own




I was just looking at this thread and something in the deepest and darkest corners of my brain (even I’m afraid to go there) began shouting for attention. So I listened and suddenly I remembered this UDF by Jooel. Ok the code is Lonkenized®©™ and sort of golfed but that’s ok the code works so no need to look at it and go almost blind or insane figuring out how it works


Edited by Mart (2006-06-16 01:44 PM)
_________________________
Mart

- Chuck Norris once sold ebay to ebay on ebay.

Top
#163324 - 2006-06-16 02:06 PM Re: Supress Output of an REG IMPORT-Command
Jochen Administrator Offline
KiX Supporter
*****

Registered: 2000-03-17
Posts: 6380
Loc: Stuttgart, Germany

> SHELL $cmd > NUL

is not correct because > NUL is outside of the quotation ... more correct use :

shell $cmd + " >nul"
_________________________



Top
#163325 - 2006-06-16 02:07 PM Re: Supress Output of an REG IMPORT-Command
Björn Offline
Korg Regular
*****

Registered: 2005-12-07
Posts: 953
Loc: Stockholm, Sweden.
Thanks Jochen, I was pondering about that *_*
But, that makes atleast 4.50 thro out an error about to many parameters...


Edited by Björn (2006-06-16 02:08 PM)
_________________________
as long as it works - why fix it?
If it doesn't work - kix-it!

Top
#163326 - 2006-06-16 02:35 PM Re: Supress Output of an REG IMPORT-Command
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
The > redirect is a function of the command interpreter so you need to invoke it. There is at least one FAQ on it.
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#163327 - 2006-06-16 03:27 PM Re: Supress Output of an REG IMPORT-Command
Jochen Administrator Offline
KiX Supporter
*****

Registered: 2000-03-17
Posts: 6380
Loc: Stuttgart, Germany
Oops, yeah.

that of course works only if you invoke %ComSpec% with the shell command ... I didn't read the original post too attentively I guess
_________________________



Top
#163328 - 2006-06-16 07:22 PM Re: Supress Output of an REG IMPORT-Command
NTDOC Administrator Offline
Administrator
*****

Registered: 2000-07-28
Posts: 11629
Loc: CA
The key is the /s that REGEDIT supports.

Now doing it via KiXtart would be better in the long run, but the original poster isn't well versed in using KiXtart yet.

When you say huge how many lines we talking about changing in the Registry?

If you post a few examples I'm sure we can show you how to write some of them.

Top
#163329 - 2006-06-21 10:14 AM Re: Supress Output of an REG IMPORT-Command
Luziekix Offline
Getting the hang of it

Registered: 2003-02-27
Posts: 68
Hi,

thank you all.

I now use REGEDIT /s which works fine, though it is undocumented
(=not help when starting REGEDIT e.g. with /? ).

I´ve tried the UDF with KIX v4.51, I seems not to work, but maybe
I´ve done something wrong, as I have yet no more experience with UDFs.

Only bad thing that REGEDITs Switch /s is only here since Windows XP,
and not seem to work in Windows 2000 (?!).

Regards,

Luziekix

Top
#163330 - 2006-06-22 02:52 AM Re: Supress Output of an REG IMPORT-Command
NTDOC Administrator Offline
Administrator
*****

Registered: 2000-07-28
Posts: 11629
Loc: CA
Well my guess is that you're not using it correctly.

Please check out the FAQ for using UDF scripts.


Regedit Command Line Switches
http://winhlp.com/WxRegeditCommandLineSwitches.htm
 
 
Code:

$Folder = '\\SERVER\NETLOGON\REGFILES\'
$File = 'regimports.reg'
SHELL '%WINDIR%\regedit.exe /S ' + $Folder+$File


Top
#163331 - 2006-06-23 06:31 AM Re: Supress Output of an REG IMPORT-Command
Kdyer Offline
KiX Supporter
*****

Registered: 2001-01-03
Posts: 6241
Loc: Tigard, OR
Please also note this is covered in the FAQ: LOADKEY - Why doesn't it work

Kent
_________________________
Utilize these resources:
UDFs (Full List)
KiXtart FAQ & How to's

Top
Page 1 of 1 1


Moderator:  Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart 
Hop to:
Shout Box

Who's Online
0 registered and 476 anonymous users online.
Newest Members
batdk82, StuTheCoder, M_Moore, BeeEm, min_seow
17885 Registered Users

Generated in 0.071 seconds in which 0.028 seconds were spent on a total of 12 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org