New Boundary Support Forum
Home      Members   Calendar   Who's On
Welcome Guest ( Login | Register )
      



How to get current PATH from .PTSExpand / Collapse
Author
Message
Posted 4/15/2010 5:43:22 AM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: Forum Members
Last Login: 5/26/2010 7:17:29 AM
Posts: 4, Visits: 15

Hello,

I'have Prism installation script based on variables like this:

/run /wait msiexec.exe /i "%REPLICA_SOURCE%\%APPNAME%\Sources\msifile.msi" /q

where %REPLICA_SOURCE% is resolved as a UNC path (“\\server\share”)
and %APPNAME% is the name of application…

All is working like a charm…

Now I want to move the application folder to another server... I have to change the %REPLICA_SOURCE% variable… but I want to make this automatically...
This is the challenge…

First attempt: Trying to use %CD%

%CD% is a batch variable that is normally resolved to the current folder in a batch file…

But in prism script (.pts) this doesn’t work...

Example after executing:

/scriptver 5
/run /wait %comspec% /c echo “%CD%” > test.txt

test.txt contain:

""

Second attempt: Set an Environment variable dynamically

I /run a simple application that write an user Environment variable like this (in c#) :

Environment.SetEnvironmentVariable("PRISM_SHARE", Parentdir, EnvironmentVariableTarget.User);

But pts script doesn’t see variable because is need to restart pts to take modification of environment variable. (I’ has tried to create variable in Process, user and machine… with all the same result)

Third attempt: Get path from registry

I /run a simple application that write in registry the Current path
and I want to get it in .PTS:

/SET REPLICA_SOURCE <Registry Value> "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\\TESTVAR"

But this doesn’t work...

Now I don’t have more idea to pass variable to .PTS

Can you help me?

Thanks a lot

Sebastien

Post #1872
Posted 4/15/2010 9:04:35 AM


Supreme Being

Supreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme Being

Group: Moderators
Last Login: 2/12/2011 11:11:06 PM
Posts: 742, Visits: 1,211
Have you tried creating a seperate .batch file to do the folder move and then calling that .bat file from within the script. 

As long as the batch file doesn't need elevation, you should be able to continue running the script the way you are now without changing who it is running as.



New Boundary Technologies Support
support@newboundary.com

Post #1873
Posted 4/15/2010 9:56:33 AM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: Forum Members
Last Login: 5/26/2010 7:17:29 AM
Posts: 4, Visits: 15
In facts %REPLICA_SOURCE% is our repository for all our packages...

It's not the role to the Script to move the Source folder....
but if I move the script on another location it must have the capabilities to self-resolve theirs path...
Post #1874
Posted 4/21/2010 1:28:42 PM


Supreme Being

Supreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme Being

Group: Moderators
Last Login: 2/12/2011 11:11:06 PM
Posts: 742, Visits: 1,211
You could use a package to create a temporary variable that the client could then use during it's session.  Essentially a package could read the registry location and then place that value into a named variable that the client would then later be able to reference.  An example package is attached.  View the Variables tab of the properties to see how it is set up.

If this package is included at the beginning of a Prism Script, then the REPLICA_SOURCE variable can be used to point to whatever the new location may be.



New Boundary Technologies Support
support@newboundary.com



  Post Attachments 
set variable.pwc (95 views, 124.00 KB)
Post #1883
« Prev Topic | Next Topic »


Reading This TopicExpand / Collapse
Active Users: 0 (0 guests, 0 members, 0 anonymous members)
No members currently viewing this topic.
Forum Moderators: New Boundary Support

PermissionsExpand / Collapse

All times are GMT -6:00, Time now is 11:58am

Powered By InstantForum.NET v4.1.3 © 2012
Execution: 0.188. 13 queries. Compression Enabled.