Link to home
Start Free TrialLog in
Avatar of Vignette
Vignette

asked on

renameming a folder

I have a installation pakage,I am using the depoyment wizard to create it.
I need to rename the old folder that the application used to install to,the in the dp wizard i will set the path to be the renamed folder.

I have a installation procees that is spawnd when i run my exe. I need to put the renaiming code in there how do i do this
ASKER CERTIFIED SOLUTION
Avatar of Ryan Chong
Ryan Chong
Flag of Singapore image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
in load method of the first form display on screen, put:

Name app.path as "c:\new Folder"

Hope this can help...
Avatar of Vignette
Vignette

ASKER

I am new to application dev.

what does app.path relate to.

what are all the different paths
yongyih, how can you name the folder that you are running your app from to something else?I don't think you can because the app is in use.

app.path relates to the directory where your app is being run from.If you are running in VB's IDE then it will be the location of your project file(.vbp) If you are running a compiled .exe then it will be the location of your .exe file.

You can test this out by using a message box in your form load event:
MsgBox = app.path
app.path will return the path of your exe file.
if your program in c:\temp, it will return "c:\temp"

to: vinnyd79
  i tried it just now. i create a new project that has a button.  the code in this button is:

  Name App.Path As "c:\temp2"

then i create an exe file for this project and copy it to c:\temp

  then, i run the program in c:\temp folder and click the button.  No error.  Then i go drive C.  The c:\temp  folder is rename to c:\temp2.

  So, i think should be no problem. If this is not what you mean, please explain again, Thank. ^_^
I have tested the app.path function this is not going to work in my case.

I am using the FileSystemObject to find the folder.

For some reason its not finding the folder my code looks something like this

 Set oFileSystemObject = CreateObject("Scripting.FileSystemObject")
sFilePath = "c:\Program Files\PWM FAP GENERATOR\"
MsgBox sFilePath
MsgBox App.Path
 If oFileSystemObject.FileExists(sFilePath) Then
    MsgBox sFilePath
   vbLogEventTypeInformation
  End If


Can anyone help me.
Would this work for windows 98 and 2000 machines
Sorry My code was wrong

it should read

Set oFileSystemObject = CreateObject("Scripting.FileSystemObject")
sFilePath = "c:\Program Files\PWM FAP GENERATOR\"
MsgBox sFilePath
MsgBox App.Path
If oFileSystemObject.FolderExists(sFilePath) Then
  'rename folder

 End If
Hi I have fixed the prob thanks for all your guys help this is the code i am using.

Will this work on windows 98 machines aswell


Set oFileSystemObject = CreateObject("Scripting.FileSystemObject")
sFilePath = "c:\Program Files\PWM DOCUMENT GENERATOR\"
MsgBox sFilePath



 If oFileSystemObject.FolderExists(sFilePath) Then
   
    Dim a As String
    Dim b As String
   
    a = sFilePath
    b = "c:\Program Files\PWM GENERATOR\"
 
   Name a As b
   
   MsgBox b
  End If
thanks for the answer