I hava a prooject that uses ShellExecuteInfo and it works fine as log as you don't want to change the name of the file.

      fei.lpFile="C:\\Program Files\\WinZip\\wzzip.exe";
      fei.lpParameters="-a+ -r -P -whs -x@nobackup.txt C:\\Progra~1\\DIR\\DIR\\Data\\ful.zip @backup.txt";
      fei.lpDirectory="C:\\Program Files\\Patches\\GLB\0";

I would like to be able to replace the "C:\\Progra~1\\DIR\\DIR\\Data\\ful.zip" with a variable newName that takes information from a user.

Thank you for any help

How are you currently trying to change it? And, what exactly goes wrong when you do try to change it?

Hi thank you for answering.

Today I thought of going another route and letting the program run as usual then when the Shellexecute completes then rename the file and move on.

WaitForSingleObject(fei.hProcess, 1000000);
      //rename the file here
      AnsiString newName = MainForm->nbn; //get the new name from the mainform

      RenameFile( "C:\\Program Files\\Patches\\GLB\\Data\\ful.zip\0",
                  "C:\\Program Files\\Patches\\GLB\\Data\0" + newName);

I get the name from a user input form the sets it into a string variable called nbn I also have it going into a label on the main form.

If I use the following it works fine:

RenameFile( "C:\\Program Files\\Patches\\GLB\\Data\\ful.zip\0",
                  "C:\\Program Files\\Patches\\GLB\\Data\\MyNewName.zip\0")

Once agian
Thank you

This article has been dead for over six months. Start a new discussion instead.