A big big thanks everyone but I have a different question on autorun commands
What im trying to do is use the script below to create folder and move files into new folder but then what im trying to do is add a command that when you open the file after merging it auto opens the associated program thats associated to it.
Sometimes it will need to open Player_Eng.exe OR Nucleus.exe but wont know what one until it tries opening the file as there will be different video types in there. It will not requre both programs to open at once it will always be one or the other.
I used to have an autorun for 1 program when I copied and pasted the files into a folder manually each time by just by copy and paste auto run into folder before burning to disk but now I automated this I donno if there is any way I can automate that too.
Any Ideas or suggestions?
Thanks
Code: Select all
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&
objWShell.Run "explorer.exe /select,""" & objFSO.BuildPath(strDLFolder, strNewFolder) & """"