Can anyone tell me why the following code returns 0 on windows 7?
Private Sub Command1_Click()
MsgBox Len(Dir("c:\windows\system32\tskill.exe"))
End Sub
Printable View
Can anyone tell me why the following code returns 0 on windows 7?
Private Sub Command1_Click()
MsgBox Len(Dir("c:\windows\system32\tskill.exe"))
End Sub
The file apparently does not exist. 64 bit editions of windows store their 32-bit binaries in Windows\SysWOW64 and their 64-bit binaries in Windows\system32. Yes, this is confusing. Perhaps that's what you're running into.
Hi jemidiah
Thanks for your relpy, although I couldn't find tskill in the Windows\SysWOW64\ directory. Also if that is the case why does this code find taskkill in the same directory?
Private Sub Command1_Click()
MsgBox Len(Dir("c:\windows\system32\taskkill.exe"))
End Sub
maybe it is not included with win 7?
edit: i found tskill.exe here
"C:\Windows\winsxs\x86_microsoft-windows-t..es-commandlinetools_31bf3856ad364e35_6.1.7600.16385_none_e486af895a57d1b2\tskill.exe"
For what it's worth, I searched my own Vista 64 (Personal or something like that edition) for tskill.exe and didn't find it.
I think the answer's obvious--taskkill.exe is apparently a 64 bit binary, or someone put it in the wrong place on accident. I wasn't saying tskill.exe is necessarily 32 bit, just that it could be. It doesn't seem to be installed on all Windows machines, which you'll have to work around somehow.Quote:
Also if that is the case why does this code find taskkill in the same directory?
Hi westconn1
The problem is that I can see tskill in the windows\system32 directory and I can use start->type "run"->type "tskill + app|pid" on Win 7 although when I try and run a dir command the file can't be seen.
jemidiah, I have read on the net that tskill should be in vista, I am not sure why you couldn't find it - is it in another directory?
It is weird behavior that I can see and shell taskkill located in windows\system32\ but not tskill. Could it be that taskkill is a 32bit application, where as tskill is a 64bit application, and the dir call to the 64 bit tskill get redirected to the C:\Windows\SysWOW64\ directory which does not contain tskill.exe?
This seems to be the workaround: use sysnative in place of system32, so Msgbox dir("c:\windows\sysnative\tskill.exe") prevents the dir call from looking in the syswow64 and gets it to check \system32 instead. It worked for me on 7, how about on vista?
I searched my entire hard drive and didn't find any tskill.exe. If the file does exist and you're just not able to Dir it, you might try adding the Read Only, Hidden, and System attributes to the call (elaborated here).
I did find taskkill.exe in both Windows\System32 and Windows\SysWOW64.
It would seem so. This page contains more information on file system redirection while running 32 bit programs on 64 bit versions of Windows. In particular it says "The Sysnative alias was added starting with Windows Vista", so your sysnative workaround should be safe as long as the file actually exists.Quote:
and the dir call to the 64 bit tskill get redirected to the C:\Windows\SysWOW64\ directory which does not contain tskill.exe?
ok it could be that only some versions of vista have it eg Vista Ultimate SP1 x64. Thanks for clearing that up jemidiah, just one of those moving to 64bit problems. :thumb:
According to this:
http://commandwindows.com/taskkill.htm
So it would seem the difference is probably the version of Windows...Quote:
Originally Posted by From_Link
There's more here:
http://www.velocityreviews.com/forum...der-wow64.html
-- It wouldn't surprise me if tskill was aliased to taskkill or vice versa in the registry somewhere... which is why tskill works from a commandline while you can't find the file in the directory. Or it could be hidden.
-tg