program-files

How do get the path of Program Files regardless of the architecture of the target machine

孤人 提交于 2019-11-30 11:12:46
I'm programming in C#/.NET. I want to be able to return the Program Files directory from the target machine no matter what the architecture of the target machine is. To clarify, I want it to return C (or whatever drive the OS is on):/Program Files no matter what bitness their version of Windows is. I could just hardcode in the directory except if the user was running Windows that's not installed on the C: drive it wouldn't work. I found FileInfo(System.Environment.GetFolderPath(System.Environment.SpecialFolder.ProgramFiles) but I think it returns the Program Files (x86) folder on a 64 bit

How do get the path of Program Files regardless of the architecture of the target machine

非 Y 不嫁゛ 提交于 2019-11-29 16:50:31
问题 I'm programming in C#/.NET. I want to be able to return the Program Files directory from the target machine no matter what the architecture of the target machine is. To clarify, I want it to return C (or whatever drive the OS is on):/Program Files no matter what bitness their version of Windows is. I could just hardcode in the directory except if the user was running Windows that's not installed on the C: drive it wouldn't work. I found FileInfo(System.Environment.GetFolderPath(System

Do applications installed to Program Files have permissions to modify their folder?

大憨熊 提交于 2019-11-29 11:49:57
If I install my app to program files, will it always be able to create and write files within its install directory? It seems to work in a lot of different versions of windows, but are there situations where this wouldn't work? Mainly I'm using this approach for logging. If this is not the correct approach, is there a better place to log? Note: My installer requires Admin privileges to run and it grants Full Access to all users in the install directory. Apps don't run as users, users run as users. If you install an app into Program Files, and let's assume you needed elevated permissions to do

Use 32bit “Program Files” directory in msbuild

旧时模样 提交于 2019-11-28 06:12:56
In 64 bit versions of windows, 32 bit software is installed in "c:\program files (x86)". This means you cannot use $(programfiles) to get the path to (32 bit) software. So I need a $(ProgramFiles32) to overcome this in my MSBuild project. I don't want to change the project depending on the os it is running on. I have a solution that I will post, but maybe there is a easier/better way. In MSBuild 4.0+, there's a $(MSBuildProgramFiles32) property for it, which you can confidently employ directly (especially if you're prepared to put a ToolsVersion="4.0" at the top of the file to guarantee it's

Do applications installed to Program Files have permissions to modify their folder?

断了今生、忘了曾经 提交于 2019-11-28 05:19:53
问题 If I install my app to program files, will it always be able to create and write files within its install directory? It seems to work in a lot of different versions of windows, but are there situations where this wouldn't work? Mainly I'm using this approach for logging. If this is not the correct approach, is there a better place to log? Note: My installer requires Admin privileges to run and it grants Full Access to all users in the install directory. 回答1: Apps don't run as users, users run

Why am i getting WindowsError: [Error 5] Access is denied?

北战南征 提交于 2019-11-28 01:49:49
Trying to create program that adds folders into program files-recieving this error: WindowsError: [Error 5] Access is denied 'C:\\Program Files\\IMP' Here is my code import os, sys, random numb= 1 x=True while x==True: newpath = ((r'C:\Program Files\IMP\folder_%s') % (numb)) if not os.path.exists(newpath): os.makedirs(newpath) numb=numb+1 if numb==11: x=False Because you have to have the "system administrator privileges" to create dirs under C:\Program Files . So try run the script with system administrators privilege. To start a command prompt as an administrator Click Start. In the Start

Use 32bit “Program Files” directory in msbuild

前提是你 提交于 2019-11-27 01:13:59
问题 In 64 bit versions of windows, 32 bit software is installed in "c:\program files (x86)". This means you cannot use $(programfiles) to get the path to (32 bit) software. So I need a $(ProgramFiles32) to overcome this in my MSBuild project. I don't want to change the project depending on the os it is running on. I have a solution that I will post, but maybe there is a easier/better way. 回答1: In MSBuild 4.0+, there's a $(MSBuildProgramFiles32) property for it, which you can confidently employ

Why am i getting WindowsError: [Error 5] Access is denied?

最后都变了- 提交于 2019-11-26 22:00:48
问题 Trying to create program that adds folders into program files-recieving this error: WindowsError: [Error 5] Access is denied 'C:\\Program Files\\IMP' Here is my code import os, sys, random numb= 1 x=True while x==True: newpath = ((r'C:\Program Files\IMP\folder_%s') % (numb)) if not os.path.exists(newpath): os.makedirs(newpath) numb=numb+1 if numb==11: x=False 回答1: Because you have to have the "system administrator privileges" to create dirs under C:\Program Files . So try run the script with