1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Redirection to clip - env dependency?

Discussion in 'Support' started by djspits, Mar 8, 2013.

  1. djspits

    Joined:
    Apr 13, 2010
    Messages:
    189
    Likes Received:
    2
    For testing purposes, especially for hunting down dependencies and side-effects, I run pieces of code in an env with all aliases and envars removed. If it crashes I put back in and document what's needed and influenced.

    That's how I came accross this simple line:
    Code:
    resolution > clip:
    and was surprised to find that restoring the PATH envar is not enough.
    Code:
    TCC: (Sys) C:\Users\dj\Batch\test.btm [31]  Access denied. C:\WINDOWS\COUTf14.JPS" 
    PATH points to all the usual places, including _windir.
    Which dependency am I missing?

    Cheers,
    DJ
     
  2. Steve Fabian

    Joined:
    May 20, 2008
    Messages:
    3,520
    Likes Received:
    4
    I believe it is environment variable TMP, or in its absence, TEMP. The age old rule of Windows itself, as well as of most programs written for Windows, is that if a directory for temporary files is not explicitly specified, the first choice is specified by %TMP if TMP is defined; second choice is %TEMP if TEMP is defined. If neither is defined, the currently running program's directory is used (for the redirection, that's Windows itself). This last element of the search has always conflicted with keeping programs safe from corruption. Apparently your version of Windows (Vista or later?) provides the safety aspect by requiring special privileges to write in the program's directory, but without changing the search rule...

    Define TMP or at least TEMP, and your problem ought to be solved...
    --
    HTH, Steve
     
  3. rconn

    rconn Administrator
    Staff Member

    Joined:
    May 14, 2008
    Messages:
    9,855
    Likes Received:
    83
    To elaborate slightly on what Steve said, since the CLIP: device doesn't actually exist in Windows, TCC needs to create a temporary file in order to emulate a device. TCC tries to create the temporary file in the path specified by (in order):
    1. The path specified by the TMP environment variable
    2. The path specified by the TEMP environment variable
    3. The path specified by the USERPROFILE environment variable
    4. The Windows directory
    In recent versions of Windows, #4 will fail unless you're running in an elevated session.
     
  4. djspits

    Joined:
    Apr 13, 2010
    Messages:
    189
    Likes Received:
    2
    Thanks guys. That was very helpful.
    DJ
     

Share This Page