0

I want a script to get a variable from a different script which are both running on the system. Is that possible?

I have two scripts running on the system, and I want one script to pull a user-defined variable instead of asking the user to input the data twice

1
  • Here is another stackoverflow post that may answer your question: Global Variables Commented Mar 27, 2014 at 15:36

2 Answers 2

0

Assuming both scripts are running concurrently, MSMQ would be one option:

What's the best way to pass values to a running/background script block?

Global Variables are only "Global" in the context of scopes in the current session. They aren't visible to a script running is a different session.

Sign up to request clarification or add additional context in comments.

Comments

0

Write it to a text file and have the other script read it. You can load up the text into a variable, then execute it as code using iex (Invoke-Expression).

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.