Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Xp_cmdshell

Author  Topic 

senthil_nagore
Master Smack Fu Yak Hacker

1007 Posts

Posted - 2009-05-26 : 05:55:27
Hi,

I try the following to execute a java program in Cmd prompt


xp_cmdshell "cd\"

xp_cmdshell "cd RMI"

xp_cmdshell "set path=c:\jdk1.6.0_10\bin"

xp_cmdshell "java RmiClient 172.16.3.114 3232 hi"


But it Shows incorrect Syntax error!

Ay one can Help me??


Senthil.C
------------------------------------------------------
[Microsoft][ODBC SQL Server Driver]Operation canceled

ShamanDBA
Starting Member

2 Posts

Posted - 2009-05-26 : 13:12:55
You would be better off putting all statements into a batch file and then executing the batch file. When you execute commands via xp_cmdshell the statements are not persistent. When you execute the first statement xp_cmdshell "cd\" that command is only good for the duration of the xp_cmdshell call therefore when you execute the next command xp_cmdshell "cd RMI" the cd\ is no longer valid.

Hope that helps.
Go to Top of Page

senthil_nagore
Master Smack Fu Yak Hacker

1007 Posts

Posted - 2009-05-28 : 06:05:45
Thanks,

I already done as like u mentioned!



Senthil.C
------------------------------------------------------
[Microsoft][ODBC SQL Server Driver]Operation canceled
Go to Top of Page
   

- Advertisement -