Is possible to extract the value of the %TEMP% system path in SSIS?

Good morning,

I'm trying to create a variable in SSIS to assign dynamically the %TEMP% Windows folder.

I've tried writing %TEMP% directly on the variable but it doesn't works.

Now I'm using a script component to extract and assign the value of %TEMP% to the variable but I'm sure that has to be a easier way to obtain this value.

The VB code that I'm using is the one published by Tim Visee in this article: http://social.msdn.microsoft.com/Forums/sqlserver/en-US/1347b1dc-3004-4119-8991-b92abde35016/get-temp-folder-path?forum=vbgeneral

Any suggestions?

Thank you!

April 3rd, 2014 9:18am

In Window 7 you can access the direct folder as,

C:\Users\username\AppData\Local\Temp

Free Windows Admin Tool Kit Click here and download it now
April 3rd, 2014 10:50am

Hello RSingh(),

You're right, that's the path for Windows 7.

The problem that I'm trying to avoid is that not always the packages are running from the same machine or system. I mean, sometimes my colleague or I can run the packages from our machines and, other times, directly on the server with a scheduled job.

The operating systems are different and the %TEMP% directory too. For that, I'm reading always the system variable to extract the path with the script component.

I would like if there is a simpler way to do this process or the one that I'm currently doing is the simplest one.

Thank you,

Virgilio

Free Windows Admin Tool Kit Click here and download it now
April 3rd, 2014 12:04pm

Thank you for the method Jayakumaur,

It works perfectly! :)

Still, the I have to embed it on a script component that was the thing that I was trying to avoid.

If nobody knows a way to extract the path without use a script component on the next hours, I'll mark your answer as the answer to my doubt.

Thank you,

Virgilio

April 3rd, 2014 12:26pm

Good morning!

Finally I achieved to obtain the value of the environmental variable %TEMP% without using a script component. The steps that I've followed are:

1. Declare a variable of string type on the package that you want to obtain the %TEMP% path.

2. Go to SSIS -> Package Configurations -> Enable package configurations -> Add... -> Configuration Type (Environment Variable) . Here you select the environment variable to use.

3. Go to the next step and select the variables in which this configuration will store the value, in my case the variable that I've created on the step 1.

4. When you run your package, your new variable will have dynamically the path indicated by the %TEMP% variable.

Virgilio

  • Marked as answer by Virckof Monday, April 07, 2014 9:21 AM
Free Windows Admin Tool Kit Click here and download it now
April 7th, 2014 9:21am

Very nice! I was glad to find your answer. Really helped!
March 21st, 2015 4:30pm

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics