xp_cmdshell

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance

From: warren (warren2600_at_yahoo.com)
Date: 07/06/04


Date: Tue, 6 Jul 2004 15:13:51 -0700

i'm trying to capture a key value and place it in a table.
I can get the value in a script, but would just like to
execute xp_cmdshell using the code and capture the output
to a table.
what am i missing?
i keep getting ...

output
NULL

here is my code: (just put my script in xp_cmdshell)

exec master..xp_cmdshell
'@echo off
set regvaluedata=
set regkey="\\server22\HKlm\software\key\key\key"
set regvalue="server"
:: line above for command (line might wrap)
for /f "Skip=4 Tokens=3" %%a in (''REG.EXE QUERY %
regkey% /v %regvalue%'') do set regvaluedata=%%a
:: line under for command
echo %regvaluedata%'

thanks in advance,
warren



Relevant Pages

  • CGIscript.net - csMailto.cgi - Remote Command Execution
    ... CGIscript.net - csMailto.cgi - Remote Command ... csMailto is a perl cgi formmail script developed by ... execute command on server and mail output to anyone ...
    (Bugtraq)
  • Re: shell scripting
    ... and am assuming an sh-compatible shell here.... ... command 1 options arguments ... To run the script, do: ... then you need to use the full path to execute it: ...
    (comp.unix.questions)
  • Re: shell scripting
    ... and am assuming an sh-compatible shell here.... ... command 1 options arguments ... To run the script, do: ... then you need to use the full path to execute it: ...
    (comp.unix.shell)
  • Re: Newbie getting desperate with for
    ... This tells the shell to run the script ... When you run a command from the shell, it first tries to directly execv ... which calls the kernel to load and execute the file. ...
    (comp.lang.python)
  • =?iso-8859-1?Q?Re:_Jcl?=
    ... I can send you a program that you execute as a step in your job and it ... I have a command and job scheduler that is available in a free version ... demand script processor with the full scripting ability so that your job ...
    (bit.listserv.ibm-main)