1.

Solve : Can anone help on Windows .BAT Filescc/ VB scripts?

Answer» HI there

Im trying to run a command using a VB script but need help finishing off if anyone can help as I aint got a clue how to do it

I have this command that creates a new folder in C :\CCTV DOWNLOADS\DownLoad of which shown below.

What im trying to do then is to 7 ZIP the new folder .

I think that its a VB Script that I need but if there an easier way it would be greatly appriciated. Is there anyway I can run a VB script or .BAT file without running as an administrator?


Thanks
Option Explicit

Const strDLFolder = "C:\CCTV DOWNLOADS\DownLoad"
Dim objFSO, objWShell, objDLFolder, strNewFolder, objFile

Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objWShell = CreateObject("WScript.Shell")


If Not objFSO.FolderExists(strDLFolder) Then objFSO.CreateFolder(strDLFolder)
objWShell.CurrentDirectory = strDLFolder
Set objDLFolder = objFSO.GetFolder(strDLFolder)
If objDLFolder.Files.Count = 0 Then WScript.Quit

Do
Err.Clear
strNewFolder = InputBox("COMPASS REF NO", vbLf & "ENTER the NAME of the folder to be created:")
If strNewFolder = False Then WScript.Quit
On Error RESUME Next
objFSO.CreateFolder strNewFolder
Loop While Err.Number <> 0 Or Not objFSO.FolderExists(strNewFolder)

On Error Goto 0
For Each objFile In objDLFolder.Files
objFSO.MoveFile objFile.Name, strNewFolder & "\"
Next
objWShell.Run "explorer.exe /select,""" & objFSO.BuildPath(strDLFolder, strNewFolder) & """"


Discussion

No Comment Found