Menu Content/Inhalt
Accueil arrow Scripting arrow Batch arrow findOnPath

Syndication

Abonnez-vous à ce fil RSS pour être tenu informé des nouveautés de ce site.

findOnPath Convertir en PDF Version imprimable Suggérer par mail
Écrit par Gilles LAURENT   
02-04-2008

Le script batch findOnPath permet d'afficher sur le flux standard stdout le chemin complet du fichier transmis comme argument. Le fichier doit être présent dans l'un des dossiers de la variable d'environnement PATH.

Historique :
Version 1.0 - première release publique

Plateformes supportées :
Windows 2000+

Pré requis :
-

Listing 1 : findOnPath.cmd

  1. @echo off
  2. ::
  3. :: findOnPath.cmd
  4. :: Attempts to find a file by searching the directories specified in the PATH environment variable
  5. ::

  6. :: enables the extensions of the command processor
  7. setlocal ENABLEEXTENSIONS

  8. :: search for the file on the path
  9. if exist "%~$PATH:1" (echo Found at %~$PATH:1) else (echo Not found on Path !)

  10. :: be a good citizen !
  11. endlocal

L'exemple ci-dessous recherche le chemin complet de l'outil subinacl.exe issu du Windows Resource Kit :

                                                                                
WSH D:\Test> @findOnPath.cmd subinacl.exe                                       
Found at C:\Program Files\Windows Resource Kits\Tools\subinacl.exe              
                                                                                

Téléchargement :

Guide PDF : -
Archive : findOnPath.cmd

Dernière mise à jour : ( 02-04-2008 )
 
< Précédent   Suivant >