• Testado nas seguintes versões do Windows®:
XP Pro 32 bits, 7 Pro 64 bits, 8.0 Pro 64 bits & 10 Pro 64 bits
• There is an option to use resources from VBS to the folder choice via window / GUI, using a bat which creates at runtime a vbs file. and running in a way that saves the briefcase chosen.
• Navegando até a pasta alvo usando a interface gráfica e mouse/rato:
• For use in a bat capturing in the variable the briefcase selected/chosen, use:
@for /f "tokens=*delims= " %%i in ('cscript //nologo escolhe_pasta.vbs')do @echo/%%i
• For use in command line capturing in the variable the briefcase selected/chosen, use:
@for /f "tokens=*delims= " %i in ('cscript //nologo escolhe_pasta.vbs')do @echo/%i
Escolher_Pasta.vbs
::• Adaptação de Scripts VBS de autoria de Rob van der Woude's
Option Explicit
Dim strPath
strPath = SelectFolder( "" )
If strPath = vbNull Then
WScript.Echo "Cancelled"
Else
WScript.Echo strPath
End If
Function SelectFolder( myStartFolder )
Dim objFolder, objItem, objShell
On Error Resume Next
SelectFolder = vbNull
Set objShell = CreateObject( "Shell.Application" )
Set objFolder = objShell.BrowseForFolder( 0, "Select Folder", 0, myStartFolder )
If IsObject( objfolder ) Then SelectFolder = objFolder.Self.Path
Set objFolder = Nothing
Set objshell = Nothing
On Error Goto 0
End Function
• Replying command line/no_file bat
rem :: na linha de comando ::
@for /f "tokens=*delims= " %i in ('cscript //nologo escolhe_pasta.vbs')do robocopy /s /e pasta "%~i"
rem :: no arquivo bat ::
@echo off & for /f "tokens=*delims= " %%i in ('cscript //nologo escolhe_pasta.vbs')do robocopy /s /e pasta "%%~i"
Thank you for the short reply Murillo!
– b8engl
Murillo, is there the possibility of displaying the Windows window? That is, that the user searches the target folder with the mouse.
– b8engl
In this case you would need to use a visual framework, such as Java Swing, or Javafx, or Delphi, etc.
– Murillo Goulart
Thank you Murillo!
– b8engl