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"
-- The generated NT cmd string
/*
NT Command
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
for /F "tokens=1,2,3,4" %i in ('dir %systemroot%\explorer.exe^|findstr /I "explorer.exe"') do @echo ~%l~%i~%j~%k~
*/
exec master..xp_cmdshell @cmdstr
-- The tilda delimited file details:
/*
output
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
~explorer.exe~12/07/1999~12:00p~238,352~
*/
-- Undocumented Method
select @filename = 'c:\winnt\explorer.exe'
exec master..xp_getfiledetails @filename
-- SP output:
/*
Alternate Name Size Creation Date Creation Time Last Written Date Last Written Time Last Accessed Date Last Accessed Time Attributes
-------------- ------ ------------- ------------- ----------------- ----------------- ------------------ ------------------ -----------
NULL 238352 19991207 120000 19991207 120000 20000904 0 32
*/
This page was last updated on May 01, 2006 04:28 PM.