日期:2014-05-18 浏览次数:20539 次
--用windows 批出来还不会写类...用sql解决了! 我刚写好,你丫就结贴了...我亏啊! DECLARE @a AS INT=1,@b AS INT,@c AS VARCHAR(200) DECLARE @t AS TABLE(sn int IDENTITY(1,1),fname varchar(200)) INSERT INTO @t EXEC xp_cmdshell 'dir D:\ll\ /o-d /b' SELECT * FROM @t SELECT @b=MAX(sn) FROM @t WHILE @a<@b BEGIN SELECT @c=fname FROM @t WHERE sn=@a DECLARE @q AS VARCHAR(1000)='xp_cmdshell ''rename D:\ll\'+@c+' '+CONVERT(VARCHAR(200),@a)+'.txt''' PRINT @q EXEC (@q) SET @a=@a+1 END