declare @justname varchar( 30 ) , @filename varchar( 30 ) , @cmdstr varchar( 255 ) select @filename = '%systemroot%\explorer.exe' select @justname = right( @filename , charindex('\' , reverse( @filename) ) - 1 ) select @cmdstr = 'for /F "tokens=1,2,3,4" %i in (''dir ' + @filename + '^|findstr /I "' + @justname + '"'') do @echo ~%l~%i~%j~%k~' select @cmdstr AS "NT Command"
exec master..xp_cmdshell @cmdstr
select @filename = 'c:\winnt\explorer.exe' exec master..xp_getfiledetails @filename
|