Redirection to clip - env dependency?

  • This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.
Apr 13, 2010
190
2
57
The Hague
#1
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
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
 

rconn

Administrator
Staff member
May 14, 2008
10,099
85
#3
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.