Bonjour les développeurs.
J'ai 2 scripts.
- Le premier génère la liste du contenu d'un dossier. Mais pour cela, il faut que ce script soit dans le dossier.
- Le second est un navigateur de dossiers. Lorsqu'on le lance, il affiche la fenêtre Rechercher un dossier.
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4 @echo off for %%* in (.) do set CurrDirName=%%~nx* DIR %1 /-p /s /o:gn > "%CurrDirName%_Dir.txt"
J'ai copié le 1er script dans le second comme cela est mentionné rem Place your original Batch code here, mais il n'y a pas de liste du contenu du dossier.
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30 @if (@CodeSection == @Batch) @then @echo off setlocal rem Place your original Batch code here rem Activate the pop-up GUI and get the folder for /F "delims=" %%a in ('CScript //nologo //E:JScript "%~F0"') do ( set selectedFolder=%%a ) rem Process the selected folder in any way you wish echo Selected folder: "%selectedFolder%" goto :EOF End of Batch section @end // JScript section // Creates a dialog box that enables the user to select a folder and display it. var title = "Select a folder", rootFolder = 12; var shl = new ActiveXObject("Shell.Application"); var folder = shl.BrowseForFolder(0, title, 0, rootFolder); WScript.Stdout.WriteLine(folder ? folder.self.path : "");
Quelle est la solution ?
Merci.
Partager