begin process at 2012 02 16 14:19:56
  Trouver un code source :
 
dans
 
Accueil > 

Code

 > 

Fichier / Disque

 > TROUVER LE NOM LONG À PARTIR DU NOM MS-DOS 8.3

TROUVER LE NOM LONG À PARTIR DU NOM MS-DOS 8.3


 Information sur la source

Note :
5,5 / 10 - par 4 personnes
5,50 / 10

  • 1

  • 2

  • 3

  • 4

  • 5

  • 6

  • 7

  • 8

  • 9

  • 10
Catégorie :Fichier / Disque Classé sous :nom, msdos, dos Niveau :Expert Date de création :05/08/2001 Vu :2 523

Auteur : Nico

Ecrire un message privé
Site perso
Commentaire sur cette source (1)
Ajouter un commentaire et/ou une note

 Description

Copiez le code dans un .BAS et exécuter la fonction comme ceci:
nom_long=trouve_le_nom_long("C:\PROGRA~1\YES .EXE")

Vous avez besoin d'un dirlistbox appelé dir1,d'une listbox appelée liste et d'un filelistbox appelé file1
Voilà, en espèrant que ce code va en aider plus d'un...

Source

  • Public Function trouve_le_nom_long(file As String) As String
  • Dir1.Path = "\"
  • chemin = "\"
  • position = 4
  • Do
  • a = InStr(position + 1, file, "\")
  • If a = 0 Then GoTo fin
  • dossier = Mid(file, position, a - position)
  • If InStr(1, dossier, "~") <> 0 Then
  • If chemin <> "\" Then
  • If Right(Dir1.Path, 1) = "\" Then
  • nom = Dir1.Path
  • Else: nom = Dir1.Path & "\"
  • End If
  • position = Len(nom) + 1
  • End If
  • For i = 0 To Dir1.ListCount - 1
  • If Left(dossier, InStr(1, dossier, "~") - 1) = UCase(Mid(Dir1.List(i), position, Len(Left(dossier, InStr(1, dossier, "~") - 1)))) And Len(Mid(Dir1.List(i), position)) > 8 Then
  • incr = Len(Dir1.List(i)) + 1
  • Do
  • incr = incr - 1
  • Loop Until Mid(Dir1.List(i), incr, 1) = "\"
  • zaza = Right(Dir1.List(i), Len(Dir1.List(i)) - incr)
  • Liste.AddItem (zaza)
  • End If
  • Next
  • chemin = chemin & Liste.List(Right(dossier, 1) - 1) & "\"
  • Liste.Clear
  • Else
  • For i = 0 To Dir1.ListCount - 1
  • If UCase(Right(Dir1.List(i), Len(dossier))) = dossier Then dossier = Right(Dir1.List(i), Len(dossier))
  • Next
  • chemin = chemin & dossier & "\"
  • End If
  • Dir1.Path = chemin
  • position = a + 1
  • Loop
  • fin:
  • trouve_le_nom_long = Dir1.Path
  • namen = trouve_le_nom_du_fichier(file, Dir1.Path)
  • If Right(trouve_le_nom_long, 1) = "\" Then
  • trouve_le_nom_long = trouve_le_nom_long & namen
  • Else: trouve_le_nom_long = trouve_le_nom_long & "\" & namen
  • End If
  • End Function
  • Public Function trouve_le_nom_du_fichier(abc As String, chemin_initial As String) As String
  • Liste.Clear
  • File1.Path = chemin_initial
  • incr = Len(abc) + 1
  • Do
  • incr = incr - 1
  • Loop Until Mid(abc, incr, 1) = "\"
  • nom = Mid(abc, incr + 1)
  • a = InStr(1, nom, "~")
  • If a = 0 Then
  • For i = 0 To File1.ListCount - 1
  • If UCase(File1.List(i)) = nom Then
  • trouve_le_nom_du_fichier = File1.List(i)
  • End If
  • Next
  • GoTo fin
  • Else
  • For i = 0 To File1.ListCount - 1
  • If Left(nom, 6) = UCase(Mid(File1.List(i), 1, Len(Left(nom, 6)))) Then
  • Liste.AddItem (File1.List(i))
  • End If
  • Next
  • trouve_le_nom_du_fichier = Liste.List(Val(Mid(nom, InStr(1, nom, "~") + 1)) - 1)
  • End If
  • fin:
  • End Function
Public Function trouve_le_nom_long(file As String) As String

Dir1.Path = "\"
chemin = "\"
position = 4
Do
a = InStr(position + 1, file, "\")
If a = 0 Then GoTo fin

dossier = Mid(file, position, a - position)


If InStr(1, dossier, "~") <> 0 Then

If chemin <> "\" Then

    If Right(Dir1.Path, 1) = "\" Then
    nom = Dir1.Path
    Else: nom = Dir1.Path & "\"
    
End If

position = Len(nom) + 1

End If




For i = 0 To Dir1.ListCount - 1
If Left(dossier, InStr(1, dossier, "~") - 1) = UCase(Mid(Dir1.List(i), position, Len(Left(dossier, InStr(1, dossier, "~") - 1)))) And Len(Mid(Dir1.List(i), position)) > 8 Then


incr = Len(Dir1.List(i)) + 1
Do
incr = incr - 1
Loop Until Mid(Dir1.List(i), incr, 1) = "\"

zaza = Right(Dir1.List(i), Len(Dir1.List(i)) - incr)



Liste.AddItem (zaza)
End If

Next

chemin = chemin & Liste.List(Right(dossier, 1) - 1) & "\"
Liste.Clear


Else


For i = 0 To Dir1.ListCount - 1
If UCase(Right(Dir1.List(i), Len(dossier))) = dossier Then dossier = Right(Dir1.List(i), Len(dossier))
Next

chemin = chemin & dossier & "\"

End If

Dir1.Path = chemin

position = a + 1



Loop


fin:
trouve_le_nom_long = Dir1.Path
namen = trouve_le_nom_du_fichier(file, Dir1.Path)
If Right(trouve_le_nom_long, 1) = "\" Then
trouve_le_nom_long = trouve_le_nom_long & namen
Else: trouve_le_nom_long = trouve_le_nom_long & "\" & namen
End If




End Function






Public Function trouve_le_nom_du_fichier(abc As String, chemin_initial As String) As String

Liste.Clear


File1.Path = chemin_initial

incr = Len(abc) + 1
Do
incr = incr - 1
Loop Until Mid(abc, incr, 1) = "\"

nom = Mid(abc, incr + 1)


a = InStr(1, nom, "~")
If a = 0 Then

For i = 0 To File1.ListCount - 1
If UCase(File1.List(i)) = nom Then
trouve_le_nom_du_fichier = File1.List(i)
End If
Next

GoTo fin

Else



For i = 0 To File1.ListCount - 1
If Left(nom, 6) = UCase(Mid(File1.List(i), 1, Len(Left(nom, 6)))) Then

Liste.AddItem (File1.List(i))
End If

Next

trouve_le_nom_du_fichier = Liste.List(Val(Mid(nom, InStr(1, nom, "~") + 1)) - 1)



End If


fin:

End Function
 



 Sources du même auteur

Source avec Zip INFORMATIONS DIVERSES SUR WINDOWS PAR API
Source avec Zip MORPION VERSION 3

 Sources de la même categorie

Source avec Zip Source .NET (Dotnet) MODIFIER LES EXTENSION DES FICHIERS par okosa
ROUTINE DIR RÉCURSIVE POUR OBTENIR LA LISTE DE TOUS LES FICH... par kerisolde
Source avec Zip Source avec une capture FILE,SECURITY,FICHIER par okosa
Source avec Zip Source avec une capture Source .NET (Dotnet) PATCHEUR DE FICHIER par tototh
Source avec Zip Source avec une capture LECTURE DES INFORMATIONS DES DISQUES COMPOSANT UN ENSEMBLE R... par jack

 Sources en rapport avec celle ci

Source avec Zip Source avec une capture Source .NET (Dotnet) RENOMMER FICHIERS MASSIVEMENT par aus3004
Source avec Zip CHOIX DE COULEUR SOUS XP EN MODE CONSOLE par ccgousset
Source avec Zip Source .NET (Dotnet) ENVOYEUR DE MAIL EN BATCH/DOS par Ant95
VBSCRIPT --> CONVERSION DE FICHIER TEXTE EN FICHIER EXCEL PA... par thorspark
Source avec Zip Source avec une capture DOS - PIPE : UN DOS PIPE REVU ET CORRIGÉ EN OCX DONC FACILE ... par yomm

Commentaires et avis

Commentaire de florantanplan le 26/04/2004 16:13:38

Déclarer les variables, tu connais!!!

 Ajouter un commentaire


Discussions en rapport avec ce code source dans le forum

Détecter fermeture fenêtre MSDos [ par Asghaard ] Bonjour,Après avoir longuement cherché, j'en arrive à vous poser la question :Comment détecter la fin du procédure en MSDOS </stro Net send de dos en VB [ par benji547 ] J'aimerai s'avoir si il existe une comande similaire a net send sous msdos ou le moyen d'utiliser les commandes msdos. Merci Utilisation de Netsh [ par XavierH ] Salut,Je cherche a utiliser la fonction "netsh" dans une appli.Sous Dos la ligne "netsh -c interface dump &gt; C:\config-bureau.cfg" marche impec et s Incérer les commandes Dos dans VB [ par Hach_net ] Salut Je veux appeler des commandes Dos dans mon projet VB Comment je peux faireMerci <IMG src="/i Programme vb6 executable en DOS [ par khadd007 ] Bonjour :)Je voudrais developper une application en vb6 ex&#233;cutable en DOS. Je m'explique, mon but &#233;tant de faire un menu ghost qui permettra saisie dans le DOS pour VBscript [VBS] [ par Amandine62 ] Salut! Voila, J'ai fait mon script il fonctionne correctement mais en fait il ne faut plus du tout q Variable VB dans commande DOS [ par drouault ] Bonjour à tous; Voici le souci : j'éxécute à partir de VB6 une commande dos qui me permet de lancer une requête qui exporte des données au format exce Variable VB dans commande DOS [ par drouault ] Bonjour à tous; Voici le souci : j'éxécute à partir de VB6 une commande dos qui me permet de lancer une requête qui exporte des données au format exce Tempo C sous DOS en miliseconde? [ par pcman5 ] Voila, j'utilise le compilateur QuickC sous DOS et je cherche a faire une temporisation en miliseconde. La fonction Sleep n'existant pas. (En tous cas Recup Terminal DOS [ par eldim ] Bonjour,Est-ce quelqu'un connais un moyen de r&#233;cup&#233;rer le contenu d'une fenetre DOS dans un richtextbox ou autre En VB6 y avait une police T


Nos sponsors


Sondage...

CalendriCode

Février 2012
LMMJVSD
  12345
6789101112
13141516171819
20212223242526
272829    

Consulter la suite du CalendriCode

 
Développement réalisé par Nicolas SOREL (Nix) avec l'aide de : Cyril DURAND et Emmanuel (EBArtSoft), Merci à Vincent pour ses précieux conseils.
CodeS-SourceS.com© Toute reproduction même partielle est interdite sauf accord écrit du Webmaster
CodeS-SourceS.com© est une marque déposée tous droits réservés

Google Coop CodeS-SourceS Google Coop CodeS-SourceS
Temps d'éxécution de la page : 5,164 sec (3)

Nous contacter | Annoncer sur CodeS-SourceS | Mentions légales