Hai everybody, I'm new here. I need help to solve my problem in vb.
I using vb 2008.
Actually I creating my application that can solve boot crash for Windows 7. I started code using batch file and convert into .exe format for application solution.
The application solution is transfer file like:
- ntoskrnl.exe
- bootmgr
- ntfs.exe
- hal.dll
Then I execute it using vb form. In real environment everything is going nice.
But when I boot that application solution that I already integrate using vb form. The application solution is running as usual but there is no transfer file into directory that I specify.
When I boot the application, directory C:\Windows\ that usually we see will change to different path like F:\Windows\ or K:\Windows\
So I scan the directory first and then execute the application solution for each path.
Is there any short method to scan directory "Windows" that can detect if it at different path.
Can I use %systemroot% and how to use it?
Hope someone can help me. TQ. :)
This is my code:
It execute when I press button.
path "x" is refer to opticaldrive.
If My.Computer.FileSystem.DirectoryExists("C:\Windows\") = True Then
Shell("x:/program files/bwef/boot crash solution/dirc.exe")
ElseIf My.Computer.FileSystem.DirectoryExists("D:\Windows\") = True Then
Shell("x:/program files/bwef/boot crash solution/dird.exe")
ElseIf My.Computer.FileSystem.DirectoryExists("E:\Windows\") = True Then
Shell("x:/program files/bwef/boot crash solution/dire.exe")
ElseIf My.Computer.FileSystem.DirectoryExists("F:\Windows\") = True Then
Shell("x:/program files/bwef/boot crash solution/dirf.exe")
ElseIf My.Computer.FileSystem.DirectoryExists("G:\Windows\") = True Then
Shell("x:/program files/bwef/boot crash solution/dirg.exe")
ElseIf My.Computer.FileSystem.DirectoryExists("H:\Windows\") = True Then
Shell("x:/program files/bwef/boot crash solution/dirh.exe")
ElseIf My.Computer.FileSystem.DirectoryExists("I:\Windows\") = True Then
Shell("x:/program files/bwef/boot crash solution/diri.exe")
ElseIf My.Computer.FileSystem.DirectoryExists("J:\Windows\") = True Then
Shell("x:/program files/bwef/boot crash solution/dirj.exe")
ElseIf My.Computer.FileSystem.DirectoryExists("K:\Windows\") = True Then
Shell("x:/program files/bwef/boot crash solution/dirk.exe")
ElseIf My.Computer.FileSystem.DirectoryExists("L:\Windows\") = True Then
Shell("x:/program files/bwef/boot crash solution/dirl.exe")
ElseIf My.Computer.FileSystem.DirectoryExists("M:\Windows\") = True Then
Shell("x:/program files/bwef/boot crash solution/dirm.exe")
ElseIf My.Computer.FileSystem.DirectoryExists("N:\Windows\") = True Then
Shell("x:/program files/bwef/boot crash solution/dirn.exe")
ElseIf My.Computer.FileSystem.DirectoryExists("O:\Windows\") = True Then
Shell("x:/program files/bwef/boot crash solution/diro.exe")
ElseIf My.Computer.FileSystem.DirectoryExists("P:\Windows\") = True Then
Shell("x:/program files/bwef/boot crash solution/dirp.exe")
ElseIf My.Computer.FileSystem.DirectoryExists("Q:\Windows\") = True Then
Shell("x:/program files/bwef/boot crash solution/dirq.exe")
ElseIf My.Computer.FileSystem.DirectoryExists("R:\Windows\") = True Then
Shell("x:/program files/bwef/boot crash solution/dirr.exe")
ElseIf My.Computer.FileSystem.DirectoryExists("S:\Windows\") = True Then
Shell("x:/program files/bwef/boot crash solution/dirs.exe")
ElseIf My.Computer.FileSystem.DirectoryExists("T:\Windows\") = True Then
Shell("x:/program files/bwef/boot crash solution/dirt.exe")
ElseIf My.Computer.FileSystem.DirectoryExists("U:\Windows\") = True Then
Shell("x:/program files/bwef/boot crash solution/diru.exe")
ElseIf My.Computer.FileSystem.DirectoryExists("V:\Windows\") = True Then
Shell("x:/program files/bwef/boot crash solution/dirv.exe")
ElseIf My.Computer.FileSystem.DirectoryExists("W:\Windows\") = True Then
Shell("x:/program files/bwef/boot crash solution/dirw.exe")
ElseIf My.Computer.FileSystem.DirectoryExists("Y:\Windows\") = True Then
Shell("x:/program files/bwef/boot crash solution/diry.exe")
ElseIf My.Computer.FileSystem.DirectoryExists("Z:\Windows\") = True Then
Shell("x:/program files/bwef/boot crash solution/dirz.exe")
Else
MsgBox("No Windows Directory Found")
End If