-------------------------------------------- ASP.Net+Android+IO开发、.Net培训、期待与您交流! -----------------------------------
利用代码创建文件:
exec xp_cmdshell 'mkdir f:\bank', no_output
exec xp_cmdshell 'mkdir f:\aaaa',no_output
exec sp_configure 'show advanced option',1
reconfigure
exec sp_configure 'xp_cmdshell',1
reconfigure
exec xp_cmdshell 'query user'
--用完后,要记得将xp_cmdshell禁用(出于安全考虑)
-- 允许配置高级选项
EXEC sp_configure 'show advanced options', 1
GO
-- 重新配置
RECONFIGURE
GO
-- 禁用xp_cmdshell
EXEC sp_configure 'xp_cmdshell', 0
GO
--重新配置
RECONFIGURE
GO
use master
exec xp_cmdshell 'mkdir F:\数据库\自制数据库\NetShopASP.NET',no_output
建库代码示例:
if exists(select * from sysdatabases where [name]='NetShopASP')
drop database NetShopASP
create database db_NetShopASP
on primary
(
name='NetShopASP',
filename='F:\数据库\自制数据库\NetShopASP.NET\db_NetShopASP.mdf',
size=3mb,
filegro