473,796 Members | 2,712 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to execute batch file from SQL Server using xp_CMDShell

1 New Member
I have created a batch file, which is using 7z command to encrypt and compress a file. The command in the batch file is
7za -TZIP a [outputfilepath] [filepath] -p[password]

I am able to run the batch file successfully from the command prompt, however when I try to execute the same file from the SQL Server using the xp_CMDShell, it gives me the following errors:
Can not open file
Access is denied.

I am logged into the sql server with a Windows account, which is a member of the administrators group and has all the rights of sa on the sql server.

Thanks
Ira
May 5 '10 #1
1 3718
ck9663
2,878 Recognized Expert Specialist
Try doing a DIR using the xp_cmdshell anc capture the result. See if you can see the batch file first before proceeding. If all is well on the file side, check your rights.

Good Luck!!!

~~ CK
May 6 '10 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

2
7255
by: den 2005 | last post by:
Hi Everybody, Is anybody knows how to Hide Execution of batch file at background? I mean without displaying the DOS Prompt window while batch file is being executed. I used code below to execute batch file. Is there other ways to do this? I need help. Thanks. Code: System.Diagnostics.Process.Start("batchfile1.bat");
3
2330
by: KRK | last post by:
I am having one batch file and using this I can start my Server. It will execute all exes while starting. Now my question is how to debug my exe using this batch file?? Is it possible to execute this batch file from my prject debug session....
2
2816
by: DB | last post by:
Hi All, I have to execute dos command containing batch file using asp.net application. Code for batch file execution is working properly when I tried it with console application but same code is not working with ASP.net application. Help will be useful......... Thanks n Regards, Deepak
3
2625
by: Chris | last post by:
Hi, How can I execute a batch file form asp.net app. I have a form which a user uploads a text file. after the file is uploaded I want a batch file to then execute and do some work. Thanks
1
8415
by: coosa | last post by:
Hi all, As the topic describes, I'd like to run a batch file using sql server. How do i do it? Thanks in advance
0
2283
by: Elroyskimms | last post by:
I need to execute a batch file via ASP.Net. In my VB.Net code, I'm using System.Diagnostics.Process to call the batch file and its appropriate command line arguments. I'm using System.Diagnostics.Process.StandardError and System.Diagnostics.Process.StandardOutput to capture and view the output and error messages. My web.config file has the following: <identity impersonate="true" userName="administrator" password="password" />
1
1570
by: Watermark | last post by:
i need help i want to call shell from php i try exec and system but it isn't working please give me help to come out of this problem
2
2843
by: RaviRajhulk | last post by:
I have tried executing executing a batch file from a perl code using system("start c:\\temp\\sample.bat") but it is not executing ,Is there any way to execute batch file from a perl code
2
14030
by: huiling25 | last post by:
I tried for several days, but none can work. IE keep showing yellow exclamation mark at the status bar after clicking "Submit" and batch file cannot be executed. The HTML file and batch file is in the same folder. Here is the code for printpage.html <html> <head> <script language="javascript" type="text/javascript"> function printFile() { var pg = document.getElementById("page").value;
0
9673
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10449
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10217
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
10003
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
5440
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5568
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4114
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3730
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2924
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.