+ Reply to Thread
Results 1 to 5 of 5

Thread: Create folder in ROOT Fails

  1. #1

    Default Create folder in ROOT Fails

    We never know whether our users are running 32 or 64 versions of XP, Win 7 or Win 8.1. In the old XP versions, there was no "ProgramData" folder but in the later Windows versions there is. We found that attempting to "create" a folder that already exists does not generate an error. We use the following code which will create the folder if it is not there and which will generate no error if it is there.

    =====

    If %_SB_ROOT%\PROGRAMDATA File or Folder doesn't exist Then
    ::Create Folder "%_SB_ROOT%\ProgramData" (Always Install)
    If %_SB_ERRORCODE% Equals "0" Then
    Display Message Box "The creation of C:\ProgramData FAILED!" -- "Create Folder ProgramData"
    End
    End
    Set File Attributes for "%_SB_ROOT%\PROGRAMDATA"

    =====

    On some machines running Windows 7 Professional 64 bit, it fails every time. Other users have no errors. We also create other folders under PROGRAMDATA and if the "%_SB_ROOT%\PROGRAMDATA" creation fails, then obviously all the sub folders fail also.

    As a side question, on all Windows computers isn't %_SB_ROOT% always the "C:" drive?

    Thanks
    -O. D.-

  2. #2
    Join Date
    Mar 2004
    Posts
    4,307

    Default Re: Create folder in ROOT Fails

    Hello,

    First of all, what you are trying to do is "suboptimal" (not recommended) in Windows (and on Vista+ not even allowed). The "All Users" profile in Windows XP is now stored in the hidden %SystemDrive%\ProgramData folder in Windows Vista and above. I would suggest to always use the correct locations for your application (see Windows development guidelines).

    BTW, the %_SB_ROOT% runtime variable contains the root drive letter of the installation folder. It is not guaranteed to be the C: drive.

    Friedrich

  3. #3
    Join Date
    Mar 2004
    Posts
    4,307

    Default Re: Create folder in ROOT Fails

    BTW, %WINVER% gives you the Windows version and "Get System Info (WOW64 Status)" lets you retrieve the OS "bitness" (32 or 64 bit). So you always have control over this process even if you don't know what kind of operating system your users have.

    Friedrich

  4. #4

    Default Re: Create folder in ROOT Fails

    On a Windows 7 64 bit machine, "Get System Info (WOW64 Status)" returns a value of 1. I assume that a 32 bit machine would return "0"? Couldn't find the answer in the Help PDF nor in "Common Definitions.sbi".

    -O. D.-

  5. #5
    Join Date
    Mar 2004
    Posts
    4,307

    Default Re: Create folder in ROOT Fails

    Yes, it only returns 1 on Windows x64 machines. Otherwise, it returns 0.

    Friedrich

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Posting Permissions

  • You may post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts
  •