惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

W
WeLiveSecurity
T
The Exploit Database - CXSecurity.com
C
CXSECURITY Database RSS Feed - CXSecurity.com
S
Security @ Cisco Blogs
T
Threat Research - Cisco Blogs
TaoSecurity Blog
TaoSecurity Blog
Recent Commits to openclaw:main
Recent Commits to openclaw:main
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
腾讯CDC
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
T
The Blog of Author Tim Ferriss
Microsoft Azure Blog
Microsoft Azure Blog
罗磊的独立博客
F
Full Disclosure
博客园 - 【当耐特】
C
CERT Recently Published Vulnerability Notes
Engineering at Meta
Engineering at Meta
Application and Cybersecurity Blog
Application and Cybersecurity Blog
T
Threatpost
I
Intezer
V2EX - 技术
V2EX - 技术
H
Hackread – Cybersecurity News, Data Breaches, AI and More
The Hacker News
The Hacker News
小众软件
小众软件
Google DeepMind News
Google DeepMind News
T
Tailwind CSS Blog
D
Darknet – Hacking Tools, Hacker News & Cyber Security
B
Blog RSS Feed
Microsoft Security Blog
Microsoft Security Blog
N
News | PayPal Newsroom
MyScale Blog
MyScale Blog
AI
AI
Vercel News
Vercel News
Spread Privacy
Spread Privacy
美团技术团队
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
The GitHub Blog
The GitHub Blog
V
Vulnerabilities – Threatpost
Schneier on Security
Schneier on Security
Cyberwarzone
Cyberwarzone
G
GRAHAM CLULEY
Help Net Security
Help Net Security
Hacker News: Ask HN
Hacker News: Ask HN
Google DeepMind News
Google DeepMind News
MongoDB | Blog
MongoDB | Blog
L
LINUX DO - 热门话题
U
Unit 42
L
LangChain Blog
Recent Announcements
Recent Announcements

博客园 - EdisonZ

TFS 服务器更换后工作区无法绑定 导出你的GAC Assembly中的DLLS MICROSOFT REPORT VIEWER 2012之无法加载相关的dll 查询可用的Nuget服务地址 认识k_BackingField【转】 EntityFramework 中生成的类加注释 Bat命令知识[转] SQL Server 2012 LocalDB 管理之旅 【转】Windows环境下.NET 操作Oracle问题 VS2012下使用 LocalDB [转]无法安装MVC3,一直卡在vs10-kb2483190 “配置系统未能初始化” 解决方法 Jquery EasyUI Form Load自动绑定Checkbox问题 DSOFramer使用说明(转载))) 所有HTTP 状态代码及其定义 swfupload 上传SecurityError Error #2156 什么是HTTP Headers? 如何把彩色网页快速变为灰色网页? IIS 应用程序池设置
利用bat批量执行脚本文件
EdisonZ · 2013-07-31 · via 博客园 - EdisonZ

1.读取目录文件

利用bat 的for命令读取中的sql文件

for /r %%c in (0*.sql) do echo %%c

%%c 相当于变量

in() 中的为循环的范围

此句的作用是显示当前目录下以0开头的sql文件

2.执行脚本文件

利用SQL SERVER 自带的SQLCMD命令来操作

SQLCMD –S 127.0.0.1 –d Product –U sa –P 123 –i test.sql –o log.txt –b

-S 服务器

-d 数据库名称

-U 用户名

-P 密码

-i 输入文件路径

-o 输出文件路径

-b 出错终止

3.最终

@echo off
for /r %%c in (0*.sql) do (
sqlcmd -S 127.0.0.1 -d ProductStore -U sa -P sa123 -i  %%c -o log.txt  
)
pause

有关bat命令和sqlcmd命令的其它信息,请百度