473,788 Members | 2,754 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Setting Environment Variables

Here's what I need to do:

1) Write "Password:" to the console
- I know how to do that
2) Accept input that is not written back to the console
- I know how to do that (Term::ReadKey)
3) Set the PASSWD variable so that when the script exits, my env
variables now include one called PASSWD that contains the text I typed
at the "Password:" prompt.
- what I need help with

Any assistance? I'm sure this is an easy one...
Jul 19 '05 #1
2 8786
Rick Kasten wrote:
Here's what I need to do: [...] 3) Set the PASSWD variable so that when the script exits, my env
variables now include one called PASSWD that contains the text I typed
at the "Password:" prompt.

Any assistance? I'm sure this is an easy one...


Not exactly easy, more like impossible. See the FAQ
perldoc -q env:
I {changed directory, modified my environment} in a perl script. How
come the change disappeared when I exited the script? How do I get my
changes to be visible?

jue
Jul 19 '05 #2
> 3) Set the PASSWD variable so that when the script exits, my env
variables now include one called PASSWD that contains the text I typed
at the "Password:" prompt.
- what I need help with

Rick, are you setting this in a win32 environment? If so, you can
use the Win32::Registry to set the variable. The key I've used to set
variables is:
HKEY_LOCAL_MACH INE\SYSTEM\Curr entControlSet\C ontrol\Session
Manager\Environ ment

Some sample code is:
use Win32::Registry ;
$p = "SYSTEM\Current ControlSet\Cont rol\Session Manager\Environ ment";
$HKEY_LOCAL_MAC HINE->Open($p, $CurrVer) || die "Open $!";

And you can either create and set or just set a value.

key->Create($newkey , name)
key->SetValue(subke y, type, value)

Hope this helps.

Howard
Jul 19 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
2229
by: Greg Lindstrom | last post by:
Hello- I am running python 2.3. on an HP-9000 box running Unix and have a POSIX script that sets up my production environment. I would like to run the script from inside a python routine and pick up the environment variables but am having trouble getting it done. Suppose the script is called setprod. How can I call this from inside a python script then pick up the env's later in my program? I've tried os.system ('setprod') and...
3
2969
by: David Durkee | last post by:
Hi, I'm trying to write a script I can run from tcsh in Terminal (on Mac OS X) that will set environment variables that can be accessed by subsequent commands I execute in that session. Not having any luck so far. Here's what I've tried: ------------ #!/usr/bin/python
6
3802
by: Fuzzyman | last post by:
Hello all, I would like to set a Windows Environment variable for another (non-child) process. This means that the following *doesn't* work : :: os.environ = value In the ``win32api`` package there is a ``GetEnvironmentVariable``
6
4315
by: shaan.shaan | last post by:
Hi I am trying to set an env. variable by exporting in unix environment on DB2. I am using export var_name=ON, but it is not taking the value of the var_name. This thing is working fine when I am doing it on a simple c++ program and retieving it by using getenv() function. Can anyone help me in getting the solution how to set an env variable in db2 zeeshan
1
6509
by: laredotornado | last post by:
Hi, I'm using PHP 4.4.4 on Apache 2 on Fedora Core 5. PHP was installed using Apache's apxs and the php library was installed to /usr/local/php. However, when I set my "error_reporting" setting to be "E_ALL", notices are still not getting reported. The perms on my file are 664, with owner root and group root. The php.ini file is located at /usr/local/lib/php/php.ini. Any ideas why the setting does not seem to be having an effect? ...
8
10096
by: Jack Vamvas | last post by:
I know that you can do : Request.ServerVariables("QUERY_STRING") but can you actually set a serverVariable? I know that sounds counter intuitive , but is it possible, via vbscipt/asp? -- Jack Vamvas ___________________________________ The latest IT jobs - www.ITjobfeed.com <a href="http://www.itjobfeed.com">UK IT Jobs</a>
5
3478
by: Henaro | last post by:
Hello~ I am having trouble setting environment variables in C++ on win32. The code that is not working is: char prxy; char pf_cmd1 = "set http_proxy="; ....
18
2495
by: Tommy Nordgren | last post by:
Given the following: def outer(arg) avar = '' def inner1(arg2) # How can I set 'avar' here ? ------------------------------------- This sig is dedicated to the advancement of Nuclear Power Tommy Nordgren tommy.nordgren@comhem.se
2
2165
by: Henry Hollenberg | last post by:
Hello, I have written a script that uses environment variables set during a particular users login in ".bash_profile" and ".profile". I have changed to that users uid and gid in my python script using: import os os.setegid os.setgid
2
2147
by: bart.hernalsteen | last post by:
Hi, I want to read the envorinment setting "path" and then on certain conditions change this setting. ex path : "%SystemRoot%\system32;%SystemRoot%;%SystemRoot% \System32\Wbem;C:\Program Files\Symantec\pcAnywhere\;" I want to add some folders to the path and delete some. But when i read the path all the system variables "ex. "%SystemRoot%\" are converted to the exact folder I store this in a string and change the string an then write...
0
9498
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10175
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8993
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7518
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6750
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5399
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5536
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4070
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2894
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.