batch file - What is the location of FINDSTR on all Windows OS from Windows XP to Windows server 2012? -


is directory of findstr c:\windows\system32\ os windows xp server 2012?

or in other words safe replace following expression in windows batch file:

findstr 

to

c:\windows\system32\findstr 

extra information completeness.

environment variable windir exists since windows 95 , contains path windows directory independent on drive located , name has.

for nt based windows (nt4, windows 2000, windows xp, vista, windows 7 / 8 / 8.1) there additionally environment variable systemroot contains path windows directory parent directory system directories

  • system32
  • sysnative (only windows x64 , 32-bit applications)
  • syswow64 (only windows x64)

for details file system redirection read file system redirector page of microsoft.

it not safe use either

%windir%\system32\findstr.exe 

or

%systemroot%\system32\findstr.exe 

i highly recommend using 1 of 2 strings in batch files not depend folders in environment variable path , file extensions in environment variable pathext.

there bad installers add folder path of installed application system environment variable path @ beginning instead of appending @ end , contain in application's folder find.exe or findstr.exe portings unix , therefore work different find.exe , findstr.exe of windows. avrstudio (or perhaps not verified latest version of avrstudio) example breaking batch files of administrators not using complete file name windows commands after installation.


Comments