%SYSTEMROOT%/Temp variable

  • Thread starter Thread starter R. Choate
  • Start date Start date
R

R. Choate

Is anybody familiar with using this syntax as a variable for a path? I have a project with a hard-coded path to C:/WINNT/TEMP

Unfortunately this is causing problems with the new laptops with Office 2003 loaded OEM. They don't have that directory and I've
been asked to try this variable shown in my subject line: %SYSTEMROOT%/Temp

I could use some advice here.
 
That is the format for working with BAT files. For excel/vba, you can use
the environ function

Sub tester1()
For i = 1 To 20
Debug.Print Environ(i)
Next
End Sub

produces:
TMP=C:\WINDOWS\TEMP
TEMP=C:\WINDOWS\TEMP
PROMPT=$p$g
winbootdir=C:\WINDOWS
PATH=C:\Program Files\Microsoft Office\Office;C:\WINDOWS;C:\WINDOWS\COMMAND
COMSPEC=C:\WINDOWS\COMMAND.COM
windir=C:\WINDOWS
BLASTER=A220 I5 D1

so if you wanted a specific variable you can do

vVar = Environ("Temp")
or
vVar=Environ("comspec")
as examples:

? environ("Temp")
C:\WINDOWS\TEMP
? environ("Comspec")
C:\WINDOWS\COMMAND.COM
? environ("Windir")
C:\WINDOWS


--
Regards,
Tom Ogilvy


R. Choate said:
Is anybody familiar with using this syntax as a variable for a path? I
have a project with a hard-coded path to C:/WINNT/TEMP
Unfortunately this is causing problems with the new laptops with Office
2003 loaded OEM. They don't have that directory and I've
 
Thanks once again. You are the man, that's for sure.
--
RMC,CPA


That is the format for working with BAT files. For excel/vba, you can use
the environ function

Sub tester1()
For i = 1 To 20
Debug.Print Environ(i)
Next
End Sub

produces:
TMP=C:\WINDOWS\TEMP
TEMP=C:\WINDOWS\TEMP
PROMPT=$p$g
winbootdir=C:\WINDOWS
PATH=C:\Program Files\Microsoft Office\Office;C:\WINDOWS;C:\WINDOWS\COMMAND
COMSPEC=C:\WINDOWS\COMMAND.COM
windir=C:\WINDOWS
BLASTER=A220 I5 D1

so if you wanted a specific variable you can do

vVar = Environ("Temp")
or
vVar=Environ("comspec")
as examples:

? environ("Temp")
C:\WINDOWS\TEMP
? environ("Comspec")
C:\WINDOWS\COMMAND.COM
? environ("Windir")
C:\WINDOWS


--
Regards,
Tom Ogilvy


R. Choate said:
Is anybody familiar with using this syntax as a variable for a path? I
have a project with a hard-coded path to C:/WINNT/TEMP
Unfortunately this is causing problems with the new laptops with Office
2003 loaded OEM. They don't have that directory and I've
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top