1.

Solve : Keep getting Variable is undefined.bat error anyone got any ideas why??

Answer»

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
I'm locking this thread and closing your tweacle ACCOUNT. You ALREADY have an active account on this site with the username shreked. One account per customer Mr. Masters.



Discussion

No Comment Found