Announcement

Collapse
No announcement yet.

NT environment variables

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Paul Purvis
    replied
    Code:
    SHELL "wscript ENV.VBS"
    works fine

    Leave a comment:


  • Steve Matthews
    replied
    Shell and Verbosity

    Originally posted by paul d purvis View Post
    ... scripts, for example. Can we shell to one?
    ... How not to display a message on the execution of the script.

    ... test file envpaul.vbs
    Part One: Shelling a script
    Sure, you can "shell" to a script. Maybe PowerBASIC's shell command/function will work, maybe not. If not, there certainly is an API shell variant that does work. You just need to find the one that causes the proper associated program to fire off based on the file type of the launched target. I don't have my code base handy, so I can't point to the API that does this. But I've done it in the past. And seen it discussed often in these forums so Googling the forums for 'shell' or 'launch' ought to land you what you need.

    Part Two: suppressing a script message
    If you don't want the script to communicate, don't tell it to communicate.
    (comment the final line in your supplied script)
    Code:
    Set objShell = WScript.CreateObject("WScript.Shell")
    Set colUsrEnvVars = objShell.Environment("volatile")
    strCurrentValue = colUsrEnvVars("paultemp")
    colUsrEnvVars("paultemp") = "paulpaul"
    'Wscript.Echo colUsrEnvVars("paultemp")
    Good luck and high scores. VBscripting is way way way more powerful than the old batch commands. Once you get a little familiar with them you'll forget all about batch stuff.

    Later: I think 'ShellExecute' is the API you will want to use.
    Last edited by Steve Matthews; 7 Nov 2007, 05:10 PM. Reason: Additional info

    Leave a comment:


  • Paul Purvis
    replied
    i am so msdos also and our software is so msdos too.
    thanks for the information to learn on Michael.

    Leave a comment:


  • Michael Mattias
    replied
    Instead of using Environment variables, you might think about using the system objects provided by Windows, e.g., atoms or memory-mapped objects.

    Environment variables are just SO "MS-DOS."

    Leave a comment:


  • Paul Purvis
    replied
    a nt windows script to create/change a volatile environment variable named paultemp and set it to paulpaul.
    sort of like set paultemp=paulpaul

    the volatile environment variable will be lost on reboot/login/relogin.

    i really almost know nothing about scripts, for example. Can we shell to one?
    How not to display a message on the execution of the script.

    place the contents in a test file envpaul.vbs


    Code:
    Set objShell = WScript.CreateObject("WScript.Shell")
    Set colUsrEnvVars = objShell.Environment("volatile")
    strCurrentValue = colUsrEnvVars("paultemp")
    colUsrEnvVars("paultemp") = "paulpaul"
    Wscript.Echo colUsrEnvVars("paultemp")

    Leave a comment:


  • Paul Purvis
    started a topic NT environment variables

    NT environment variables

    some left over candy from halloween
    who says you cannot have your cake and eat it too.
    i did not realize there where ways to make environment variables stick and nt makes it harder.

    do a web search for setx.exe from microsoft
    and also look at the goodies at the website below.

    http://www.ss64.com/nt/setx.html

    http://barnyard.syr.edu/%7Evefatica/#SETENV

    using the setenv with the volatile settings from the website above is really going to help me do a lot flexible things now.
    i already have a batch file that runs everytime our computers are booted, now i can customize into much greater depth and have more flexibility for different users.
    Last edited by Paul Purvis; 6 Nov 2007, 05:45 PM.
Working...
X