using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Configuration;
using System.Data.SqlClient;
using System.Data;
using System.Diagnostics;
namespace Sample2
{
class Program
{
static void Main(string[] args)
{
Process proc = null;
try
{
/*
* autorun.bat文件内容
osql -S 127.0.0.1 -d DataSample -U sa -P 1234567890 -i C:\test.sql
*/
string targetDir = string.Format(@"C:\");
proc = new Process();
proc.StartInfo.WorkingDirectory = targetDir;
proc.StartInfo.FileName = "autorun.bat";
proc.StartInfo.Arguments = string.Format("");//this is argument
proc.StartInfo.CreateNoWindow = true;
proc.
C#中执行批处理文件(.bat),执行数据库相关操作
最新推荐文章于 2023-03-03 17:01:57 发布
![](https://img-home.csdnimg.cn/images/20240711042549.png)