PDA

View Full Version : Using variables for an unknown path


Larva King
06-14-2007, 06:04 PM
I am trying to copy a file from my disc by pressing a button to a folder in my program files. I want to use a variable for my harddrive as if the drive letter is unknown. I dont want to repeat the command C, D,E, F, G, etc.

what is wrong with the command below it does not work when I use it?

File.Copy("<Folder>\\<file>", "%systemdrive%\\Program Files\\<Folder>\\", true, true, false, true, nil);

However it does work when I use "C:\\Program Files\\<folder>\\

4090987414711
06-14-2007, 06:35 PM
if the file you want to copy is on the same drive as your app, Insted of %Systemdrive%, try _SourceDrive.. this might help :)

also just in case it helps,
_SourceFolder - to use the same folder as the app uses
_ProgramFilesFolder - self explanatory!

Larva King
06-14-2007, 07:12 PM
Thank you for the fast reply, but that is not working for me either.
How ever my original command works through SFX files. So for right now I will run an SFX file in silent mode through Autoplay. Again, Thank you for your help.

4090987414711
06-14-2007, 08:07 PM
No problem :)

I just wish I could have helped with something that worked!

Larva King
06-14-2007, 08:46 PM
Thank you, yes I would rather run commands directly through autoplay than use 3rd party programs to complete my desired instructions.