Reputation:
Please advice
I compiled the following VB6 code ( as --> file --> make project.exe )
But when I run it I get a very strange thing ( I have WIN XP machine )
In spite I defined to run this line:
"java -jar run.jar"
under
C:\Program Files\APP\SW_TOP\Java by chDir
msgBox print diff PATH:
D:\Documents and Settings\Eytan\Desktop
please advice why?
Why chDir not change the directory in my VB6 Code – what's wrong?
VB6 Code:
Private Sub Command_Click()
ChDir ("C:\Program Files\APP\SW_TOP\Java ")
Shell Environ("COMSPEC") & " /c java -jar run.jar", vbNormalFocus
MsgBox App.Path
End Sub
Please advice if there are some other alternative in order to run the "java -jar run.jar" under
C:\Program Files\APP\SW_TOP\Java
Upvotes: 2
Views: 4968
Reputation: 43743
You can have a different "current directory" on each drive. So, while your call to ChDir
changes your current directory on the C: drive, it doesn't change your current drive from D: to C:. To switch your current drive, use the ChDrive
procedure:
ChDrive "C:"
ChDir "C:\Program Files\APP\SW_TOP\Java "
Upvotes: 4
Reputation: 2526
The body of your question asks why MsgBox App.Path
does not show C:\Program Files\APP\SW_TOP\Java
. The reason is because App.Path has the location of your program, not the current working directory.
From the documentation:
For the App object, Path specifies the path of the project .VBP file when running the application from the development environment or the path of the .exe file when running the application as an executable file.
Upvotes: 1