0
I’m having trouble creating folders within program files.
Where I work there is an application that only works if the files are inside program files and the process of creating the folders today is totally manual.
Nobody volunteered to make an installer to automate this, so since I’m a computer major, I decided to take this task even as a challenge.
The problem that I am finding is the permissioning of Windows to create folders within program files, because if it were elsewhere would be good.
I need before creating the folders have access as administrator to create the folders on the computer.
I’m using the following code:
// Verifica qual radio button está selecionado.
if (rd_golden.Checked)
{
//Cria o diretorio para o Golden e faz o procedimentos locais
string Golden = @"C:\Program Files\Comercial\Golden";
if (!Directory.Exists(Golden))
{
Directory.CreateDirectory(Golden);
MessageBox.Show("Diretório Criado com Sucesso!!");
}
else
{
MessageBox.Show("Diretório já Existe");
}
}
Because the program only works if the files are inside program files?
– mcamara
If you are running the program with Administrator privileges you can create the folder! I don’t think there’s a way to do that automatically.
– mcamara