Home > Software engineering >  Could you tell me how VBS code into vb6 code?
Could you tell me how VBS code into vb6 code?

Time:09-22

The Set of fso=CreateObject (" Scripting. FileSystemObject ")
The Set w=createobject (" wscript. Shell ")


Sub error ()
Msgbox "the directory is not a JDK installation directory!" , 16 + 4096, "set the JDK environment variables (By unscrupulous Fly kite)"
The main ()
End sub


'==================automatically finds the JDK directory (in the Program Files folder)==================
The function findJava ()
Dim java_path
Windows_disk=fso. Getdrivename (fso. Getspecialfolder (WindowsFolder))
If fso. Folderexists (windows_disk & amp;" \ \ Program Files \ Java \ ") then
The set java_path=fso. Getfolder (" C: \ Program Files \ Java \ ")
Elseif fso. Folderexists (windows_disk & amp;" \ \ Program Files (x86) \ Java \ ") then
The set java_path=fso. Getfolder (" C: \ Program Files \ Java \ (x86) ")
End the if
For Each folder In java_path. Subfolders
If InStr (1, folder, "JDK") & gt; 0 Then
If fso. Fileexists (folder&" Exe \ bin \ Java ") then
FindJava=folder
End the if
End the if
Next
End the function


Sub main ()
Folder=findJava ()
Java=folder
AutoSet=true
If the folder="" then
The Set objShell=CreateObject (" Shell. Application ")
Set the folder=objShell. BrowseForFolder (0, "choose the JDK installation directory:" & amp; CRH (13) & amp;" By unscrupulous kite Fly "& amp; CRH (13) & amp;" Set the environment variable will take some time, please be patient, "0, 2)
If the folder is nothing then
Wscript. Quit
End the if
If the folder. The self. The path=": : {20 d04fe0 b30309d - 3 - A2D8 aea - 1069-08002}" then
Error ()
End the if
Set the Java=fso. Getfolder (folder. The self. The path)
AutoSet=false
End the if
If fso. Fileexists (java&" Exe \ bin \ Java ") then
Java_home=w.E nvironment (" user "). The Item (" java_home ")
If java_home & lt;> "" then
Msgbox "has no longer need to set up!" JDK environment variables set, 48 + 4096, ""
The else
If autoSet then
Msgbox "have found the JDK directory" & amp; CRH (13) & amp;" Will be set after the confirmation of the click, it may take some time ", 64, "set the JDK environment variables (By unscrupulous Fly kite)"
End the if
W.E nvironment (" user "). The Item (" java_home ")=Java
W.E nvironment (" user "). The Item (" Path ")=w.E nvironment (" user "). The Item (" Path ") & amp;" % java_home % \ bin "
W.E nvironment (" user "). The Item (" class ")=w.E nvironment (" user "). The Item (" class ") & amp; "; .; % java_home % \ lib \ tools. Jar; The % java_home % \ lib \ dt. The jar "
Msgbox "the environment variables set!" , 64 + 4096, "set the JDK environment variables (By unscrupulous Fly kite)"
End the if
The else
Error ()
End the if
End sub


The main ()

This is the code, VBS process I use call call, but there is an error

CodePudding user response:

Copied in the past,

CodePudding user response:

Can copy the past if I won't be directly used to post the grammatical errors

CodePudding user response:

Are you doing a tool to automatically install Java

CodePudding user response:

1) to start two Set move to the Main () in the beginning,
2) the error () inside the the main () call should be removed, call each other does not end,
3) the error () Call to Call error ,
4) the last sentence the main () ,

CodePudding user response:

The
reference 3 floor xiaoyao961 response:
are you doing you a tool to automatically install Java

Automatic configuration of Java environment variables

CodePudding user response:

reference 4 floor Tiger_Zhao response:
1) the beginning two Set move to the Main () beginning,
2) the error () inside the the main () call should be removed, call each other does not end,
3) the error () Call to Call error ,
4) the last sentence the main () ,


Hello,
If fso. Folderexists (windows_disk & amp;" \ \ Program Files \ Java \ ") then
Such statements suggest grammatical errors

CodePudding user response:

The operator & amp; on both sides should have space,
Are most basic grammar question, it's the first in the MSDN help VBREF98. CHM reference section through the,
  • Related