Hi
I have a .VBS script and a .bat file that im trying to run together.
Ive got this script that suppoused to runs the VBS script and then open the .BAT file.
I keep getting the error variable is undefined .bat error come up when trying to run it. Can anyone help.
Thanks
Option Explicit
Const strDLFolder = "C:\Downloads"
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("Folder Name", 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.Popup "All files moved.", 0, "Done", vbInformation Or vbSystemModal Or &h00040000&
dim dotbat
set dotbat=createobject("wscript.shell")
dotbat.Run "C:\Desktop\testersnew.bat", 1, True
set dotbat=Nothing
and ive also tried the command below too in the middle.
dotbat.Run "cmd /C C:\Desktop\testersnew.bat", 1, True