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 Administration (2000)
 put a cmd file in a job

Author  Topic 

joanne
Starting Member

46 Posts

Posted - 2005-03-11 : 08:21:45
Hi,
I want to know if a can run a cmd file via a job and if yes, how.
Thanks very much

TG
Master Smack Fu Yak Hacker

6065 Posts

Posted - 2005-03-11 : 08:39:30
Yes. In the jobstep, change the "type" to "Operating System Command (cmdExec)". Then put whatever you would type on the command line in the "Command" window.

Be One with the Optimizer
TG
Go to Top of Page

joanne
Starting Member

46 Posts

Posted - 2005-03-11 : 08:43:03
thanks again.it work well.
Go to Top of Page

joanne
Starting Member

46 Posts

Posted - 2005-03-11 : 09:08:27
I think it`s not so well. When i run this command:
USE master
EXEC xp_cmdshell 'D:\under_4mars2005\all_user_revised.cmd'

It give me this message:
NULL
C:\WIN2000\system32>java -jar xrm-user-import.jar all_user_revised.csv.xml 1>all_user_revised.log
java.util.zip.ZipException: The system cannot find the file specified
at java.util.zip.ZipFile.open(Native Method)
at java.util.zip.ZipFile.<init>(Unknown Source)
at java.util.jar.JarFile.<init>(Unknown Source)
at java.util.jar.JarFile.<init>(Unknown Source)
Exception in thread "main"
Any idea?

Go to Top of Page

jason
Posting Yak Master

164 Posts

Posted - 2005-03-11 : 10:11:16
If you are scheduling the job, make sure the SQL Server agent service account has permission to the folder locations where you are executing the command.

If the person scheduling the job is not a sysadmin, setup a SQL proxy account (Job System tab in SQL Server Agent properites). Make sure you understand the security implications of this.

Also, make sure all referenced commands, batch jobs, and executables are in the DOS path environment variable are call them using the full path.
Go to Top of Page

joanne
Starting Member

46 Posts

Posted - 2005-03-11 : 15:49:09
Yes, it was a problem with the full path
Go to Top of Page
   

- Advertisement -