找到notepad.exe和mspaint.exe的路径 [英] Find the path of notepad.exe and mspaint.exe
问题描述
如何找到notepad.exe和mspaint.exe在Windows的各个版本中工作的最佳方式是什么?通过 SHGetFolderPath(NULL,CSIDL_WINDOWS,NULL,SHGFP_TYPE_CURRENT,dir)
,然后遍历所有的子目录来寻找这两个文件?
(假设我对Windows文件夹以外的东西不感兴趣)
(XP +)。 c:\> (cmd.exe)执行@echo%〜$ PATH:i
C:\WINDOWS\system32\cmd.exe
c:\> (python.exe)中的%i执行@echo%〜$ PATH:i
C:\Python25\python.exe
好的是,你不用 来使用实际的%PATH%
,你可以通过使用不同的环境变量来替代您自己的搜索路径。
What is the best way to find out where notepad.exe and mspaint.exe are that will work across various versions of Windows?
Should I get the Windows directory via SHGetFolderPath(NULL, CSIDL_WINDOWS, NULL, SHGFP_TYPE_CURRENT, dir)
, and then traverse through all the subdirectories to look for the two files?
(Assume that I am not interested in anything outside the Windows folder.)
This works on every Windows box I've got access to (XP+).
c:\> for %i in (cmd.exe) do @echo %~$PATH:i
C:\WINDOWS\system32\cmd.exe
c:\> for %i in (python.exe) do @echo %~$PATH:i
C:\Python25\python.exe
The great thing is, you don't have to use the actual %PATH%
, you can substitute your own search path by using a different environment variable.
这篇关于找到notepad.exe和mspaint.exe的路径的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!