Aide batch parametré
Résolu
reseau0010
Messages postés
249
Date d'inscription
Statut
Membre
Dernière intervention
-
reseau0010 Messages postés 249 Date d'inscription Statut Membre Dernière intervention -
reseau0010 Messages postés 249 Date d'inscription Statut Membre Dernière intervention -
bonjour tout le monde
je veux creer un batch qui peut creer des dossiers ainsi que sous-dossier
le probleme c est il doit parametré
1 - apres execution de ce batch
il doit donner de choisir quelle c: ou d:
apres choix il doit afficher un msg de confirmation
si oui : il doit continuer
si non : il doit afficher le msg de choix du partiotion
apres confirmation "oui" il cree les dossiers ainsi les sous-dossiers deja configurés
par ex si on choisi c:
md 1
md 2
cd1
md 11
md12
cd..
cd 2
md21
md22
cd 22
md221
merci d avance les amis
je veux creer un batch qui peut creer des dossiers ainsi que sous-dossier
le probleme c est il doit parametré
1 - apres execution de ce batch
il doit donner de choisir quelle c: ou d:
apres choix il doit afficher un msg de confirmation
si oui : il doit continuer
si non : il doit afficher le msg de choix du partiotion
apres confirmation "oui" il cree les dossiers ainsi les sous-dossiers deja configurés
par ex si on choisi c:
md 1
md 2
cd1
md 11
md12
cd..
cd 2
md21
md22
cd 22
md221
merci d avance les amis
A voir également:
- Aide batch parametré
- Paramètre story facebook - Guide
- Remettre parametre usine pc - Guide
- Parametre dns - Guide
- Fichier batch - Guide
- Parametre windows - Guide
9 réponses
Dim fsoopen, fsocreate, f, fexist
ChoixDrive= inputbox ("Quel lecteur ?")
Set fsocreate = CreateObject("scripting.filesystemobject" )
Set fexist = CreateObject("scripting.filesystemobject" )
i=1
j=1
If fexist.Folderexists(ChoixDrive & ":\test\") <> true then
Set f = fsocreate.CreateFolder(ChoixDrive & ":\test\") 'creation du répertoire
End If
For i=1 to 2
'MsgBox (ChoixDrive & ":\test\" & i)
If fexist.Folderexists(ChoixDrive & ":\test\" & i) <> true then
Set f = fsocreate.CreateFolder(ChoixDrive & ":\test\" & i) 'creation du répertoire
End If
For j=1 to 2
If fexist.Folderexists(ChoixDrive & ":\test\" & i & "\" & i & j) <> true then
Set f = fsocreate.CreateFolder(ChoixDrive & ":\test\" & i & "\" & i & j) 'creation du répertoire
End If
Next
Next
ChoixDrive= inputbox ("Quel lecteur ?")
Set fsocreate = CreateObject("scripting.filesystemobject" )
Set fexist = CreateObject("scripting.filesystemobject" )
i=1
j=1
If fexist.Folderexists(ChoixDrive & ":\test\") <> true then
Set f = fsocreate.CreateFolder(ChoixDrive & ":\test\") 'creation du répertoire
End If
For i=1 to 2
'MsgBox (ChoixDrive & ":\test\" & i)
If fexist.Folderexists(ChoixDrive & ":\test\" & i) <> true then
Set f = fsocreate.CreateFolder(ChoixDrive & ":\test\" & i) 'creation du répertoire
End If
For j=1 to 2
If fexist.Folderexists(ChoixDrive & ":\test\" & i & "\" & i & j) <> true then
Set f = fsocreate.CreateFolder(ChoixDrive & ":\test\" & i & "\" & i & j) 'creation du répertoire
End If
Next
Next
bnj merci pour la reponse mais j ai essayé de modifier ce code pour faire mon travail ça marche pas
mnt le trv que je veux realise c:
j prend comme repertoire d:
d:\logiciels\design\3D\DOC
d:\logiciels\design\3D\EXE
""
d:
logiciels
design
3d
doc
exe
merci encore de ton aide
mnt le trv que je veux realise c:
j prend comme repertoire d:
d:\logiciels\design\3D\DOC
d:\logiciels\design\3D\EXE
""
d:
logiciels
design
3d
doc
exe
merci encore de ton aide
ok, t as d autres repertoire à créer ou pas??
sinon la solution est :
ChoixDrive= inputbox ("Quel lecteur ?")
Set fsocreate = CreateObject("scripting.filesystemobject" )
Set fexist = CreateObject("scripting.filesystemobject" )
MesRep=Array("DOC","EXE")
for i=1 to 2
If fexist.Folderexists(ChoixDrive & ":\test\" & MesRep(i)) <> true then
Set f = fsocreate.CreateFolder(ChoixDrive & ":\test\" & MesRep(i)) 'creation du répertoire
End If
next
sinon la solution est :
ChoixDrive= inputbox ("Quel lecteur ?")
Set fsocreate = CreateObject("scripting.filesystemobject" )
Set fexist = CreateObject("scripting.filesystemobject" )
MesRep=Array("DOC","EXE")
for i=1 to 2
If fexist.Folderexists(ChoixDrive & ":\test\" & MesRep(i)) <> true then
Set f = fsocreate.CreateFolder(ChoixDrive & ":\test\" & MesRep(i)) 'creation du répertoire
End If
next
Vous n’avez pas trouvé la réponse que vous recherchez ?
Posez votre question
est ce que :\logiciels\design\3D est deja creer ??
sinon, rajoute au debut du prog :
If fexist.Folderexists(ChoixDrive & ":\logiciels\") <> true then
Set f = fsocreate.CreateFolder(ChoixDrive & ":\logiciels\") 'creation du répertoire
End If
If fexist.Folderexists(ChoixDrive & ":\logiciels\design\") <> true then
Set f = fsocreate.CreateFolder(ChoixDrive & ":\logiciels\design\") 'creation du répertoire
End If
If fexist.Folderexists(ChoixDrive & ":\logiciels\design\3D\") <> true then
Set f = fsocreate.CreateFolder(ChoixDrive & ":\logiciels\design\3D\") 'creation du répertoire
End If
sinon, rajoute au debut du prog :
If fexist.Folderexists(ChoixDrive & ":\logiciels\") <> true then
Set f = fsocreate.CreateFolder(ChoixDrive & ":\logiciels\") 'creation du répertoire
End If
If fexist.Folderexists(ChoixDrive & ":\logiciels\design\") <> true then
Set f = fsocreate.CreateFolder(ChoixDrive & ":\logiciels\design\") 'creation du répertoire
End If
If fexist.Folderexists(ChoixDrive & ":\logiciels\design\3D\") <> true then
Set f = fsocreate.CreateFolder(ChoixDrive & ":\logiciels\design\3D\") 'creation du répertoire
End If
bnj j ai arriver à faire le necessaire
le code final est
Dim fsoopen, fsocreate, f, fexist
ChoixDrive= inputbox ("Quel lecteur ?")
Set fsocreate = CreateObject("scripting.filesystemobject" )
Set fexist = CreateObject("scripting.filesystemobject" )
If fexist.Folderexists(ChoixDrive & ":\logiciels\") <> true then
Set f = fsocreate.CreateFolder(ChoixDrive & ":\logiciels\") 'creation du répertoire
End If
If fexist.Folderexists(ChoixDrive & ":\logiciels\design\") <> true then
Set f = fsocreate.CreateFolder(ChoixDrive & ":\logiciels\design\") 'creation du répertoire
End If
If fexist.Folderexists(ChoixDrive & ":\logiciels\design\3D\") <> true then
Set f = fsocreate.CreateFolder(ChoixDrive & ":\logiciels\design\3D\") 'creation du répertoire
End If
If fexist.Folderexists(ChoixDrive & ":\logiciels\design\3D\doc") <> true then
Set f = fsocreate.CreateFolder(ChoixDrive & ":\logiciels\design\3D\doc") 'creation du répertoire
End If
If fexist.Folderexists(ChoixDrive & ":\logiciels\design\3D\exe") <> true then
Set f = fsocreate.CreateFolder(ChoixDrive & ":\logiciels\design\3D\exe") 'creation du répertoire
End If
mais j ai encore 3 simples questions
1- quel est le role du commande ""next""
2- comment donner un titre pour ce code qui s affiche en haut de la fenetre
3- comment convertir ce vbs a un fichier .exe pour le securise d aucune modification
encore une fois merci beaucoup pour ton aide
le code final est
Dim fsoopen, fsocreate, f, fexist
ChoixDrive= inputbox ("Quel lecteur ?")
Set fsocreate = CreateObject("scripting.filesystemobject" )
Set fexist = CreateObject("scripting.filesystemobject" )
If fexist.Folderexists(ChoixDrive & ":\logiciels\") <> true then
Set f = fsocreate.CreateFolder(ChoixDrive & ":\logiciels\") 'creation du répertoire
End If
If fexist.Folderexists(ChoixDrive & ":\logiciels\design\") <> true then
Set f = fsocreate.CreateFolder(ChoixDrive & ":\logiciels\design\") 'creation du répertoire
End If
If fexist.Folderexists(ChoixDrive & ":\logiciels\design\3D\") <> true then
Set f = fsocreate.CreateFolder(ChoixDrive & ":\logiciels\design\3D\") 'creation du répertoire
End If
If fexist.Folderexists(ChoixDrive & ":\logiciels\design\3D\doc") <> true then
Set f = fsocreate.CreateFolder(ChoixDrive & ":\logiciels\design\3D\doc") 'creation du répertoire
End If
If fexist.Folderexists(ChoixDrive & ":\logiciels\design\3D\exe") <> true then
Set f = fsocreate.CreateFolder(ChoixDrive & ":\logiciels\design\3D\exe") 'creation du répertoire
End If
mais j ai encore 3 simples questions
1- quel est le role du commande ""next""
2- comment donner un titre pour ce code qui s affiche en haut de la fenetre
3- comment convertir ce vbs a un fichier .exe pour le securise d aucune modification
encore une fois merci beaucoup pour ton aide
bonjour
non aucune repertoire n est cree tout le contenu (les dossiers ) sont crees apres l execution de code et exactement apres le choix du partitionn
j ai essayé de rassemblé les deux code, ainsi de faire des changements mais vraiment j arrive pas à trouver des solution
ChoixDrive= inputbox ("Quel lecteur ?")
If fexist.Folderexists(ChoixDrive & ":\logiciels\") <> true then
Set f = fsocreate.CreateFolder(ChoixDrive & ":\logiciels\") 'creation du répertoire
End If
If fexist.Folderexists(ChoixDrive & ":\logiciels\design\") <> true then
Set f = fsocreate.CreateFolder(ChoixDrive & ":\logiciels\design\") 'creation du répertoire
End If
If fexist.Folderexists(ChoixDrive & ":\logiciels\design\3D\") <> true then
Set f = fsocreate.CreateFolder(ChoixDrive & ":\logiciels\design\3D\") 'creation du répertoire
End If
Set fsocreate = CreateObject("scripting.filesystemobject" )
Set fexist = CreateObject("scripting.filesystemobject" )
MesRep=Array("DOC","EXE")
for i=1 to 2
If fexist.Folderexists(ChoixDrive & ":\test\" & MesRep(i)) <> true then
Set f = fsocreate.CreateFolder(ChoixDrive & ":\test\" & MesRep(i)) 'creation du répertoire
End If
next
"" stp si tu verifies ce code ainsi de me donner le code final qui va creer cette arborescence
puisque vraiment j ai pas de grande chose en script ""
merci encore de ton aide
non aucune repertoire n est cree tout le contenu (les dossiers ) sont crees apres l execution de code et exactement apres le choix du partitionn
j ai essayé de rassemblé les deux code, ainsi de faire des changements mais vraiment j arrive pas à trouver des solution
ChoixDrive= inputbox ("Quel lecteur ?")
If fexist.Folderexists(ChoixDrive & ":\logiciels\") <> true then
Set f = fsocreate.CreateFolder(ChoixDrive & ":\logiciels\") 'creation du répertoire
End If
If fexist.Folderexists(ChoixDrive & ":\logiciels\design\") <> true then
Set f = fsocreate.CreateFolder(ChoixDrive & ":\logiciels\design\") 'creation du répertoire
End If
If fexist.Folderexists(ChoixDrive & ":\logiciels\design\3D\") <> true then
Set f = fsocreate.CreateFolder(ChoixDrive & ":\logiciels\design\3D\") 'creation du répertoire
End If
Set fsocreate = CreateObject("scripting.filesystemobject" )
Set fexist = CreateObject("scripting.filesystemobject" )
MesRep=Array("DOC","EXE")
for i=1 to 2
If fexist.Folderexists(ChoixDrive & ":\test\" & MesRep(i)) <> true then
Set f = fsocreate.CreateFolder(ChoixDrive & ":\test\" & MesRep(i)) 'creation du répertoire
End If
next
"" stp si tu verifies ce code ainsi de me donner le code final qui va creer cette arborescence
puisque vraiment j ai pas de grande chose en script ""
merci encore de ton aide
bonjour
comment afficher un message d erreur apres que l utilisateur entre une lettre d une partition qui n existe pas
ainsi de donner les listes des lettres des partition qui existent au niveau de poste
merci beucoup
comment afficher un message d erreur apres que l utilisateur entre une lettre d une partition qui n existe pas
ainsi de donner les listes des lettres des partition qui existent au niveau de poste
merci beucoup
'Lister les lecteurs:
ListeDrv = ""
Set Obj_FSO = CreateObject("Scripting.FileSystemObject")
'Parcourir tous les objets lecteurs du PC.
For Each drvValue In Obj_FSO.Drives
'Ne pas tenir compte du lecteur A sinon il cherche quelques secondes pour trouver
'une disquette (Ca ralentie et c'est bruyant).
If drvValue.DriveLetter <> "A" Then
'Regarder si le lecteur est disponible
If drvValue.Isready Then
ListeDrv = ListeDrv & drvValue.DriveLetter & ";"
End If
End If
Next
' Libérer les objets
Set Obj_FSO = Nothing
------------------------------------------------------------
Tu peux mettre aussi ListeDrv en tableau et tester apres l inputbox si la lettre rentrée est dans ce tableau ;)
ListeDrv = ""
Set Obj_FSO = CreateObject("Scripting.FileSystemObject")
'Parcourir tous les objets lecteurs du PC.
For Each drvValue In Obj_FSO.Drives
'Ne pas tenir compte du lecteur A sinon il cherche quelques secondes pour trouver
'une disquette (Ca ralentie et c'est bruyant).
If drvValue.DriveLetter <> "A" Then
'Regarder si le lecteur est disponible
If drvValue.Isready Then
ListeDrv = ListeDrv & drvValue.DriveLetter & ";"
End If
End If
Next
' Libérer les objets
Set Obj_FSO = Nothing
------------------------------------------------------------
Tu peux mettre aussi ListeDrv en tableau et tester apres l inputbox si la lettre rentrée est dans ce tableau ;)
merci bcp