1
   

"Environmental Variables" in batch files

 
 
Reply Thu 10 Jul, 2003 04:09 am
Hello,

What are the Environmental Variables I can use in ".bat" files. For example %SystemRoot% stands for C:\Windows. But how about C:\Windows\system32 (or C:\Windows\system in windows 98). Is there an identical Environmental Variables for both Windows 2000 & 98's system directory?
  • Topic Stats
  • Top Replies
  • Link to this Topic
Type: Discussion • Score: 1 • Views: 5,105 • Replies: 7
No top replies

 
fishin
 
  1  
Reply Thu 10 Jul, 2003 06:18 am
There are no "\system\" directory variables immediately available. You have to remember that what you are playing with is the old MS-DOS bat programming language and that was long before Windows existed in any form and the "\system\" dirsctories hadn't even been comtemplated yet.

You can however create your own variables using the "SET variable name= xxxx" command.

It's been a few years since I've done much batch file programming and I tossed all my books on it a while back. You should be able to find a bunch of references on the WWW though. Try "MS-DOS Batch File Programming" in Google.
0 Replies
 
MassDaemon
 
  1  
Reply Fri 11 Jul, 2003 08:19 pm
Windows XP is still using "Environmental Variables"
System Properties --> Advanced --> Environmental Variables
By the way, here is my problem:
I need to write a script, which copies some files in to every Windows' system directory, which is a common task, and I don't want to go deep into programming. The easiest possible way!
0 Replies
 
inkedmn
 
  1  
Reply Thu 17 Jul, 2003 04:17 pm
the easiest way would be to use a scripting language.

email me and i'll hack something out for you, wouldn't take but a minute...
0 Replies
 
Monger
 
  1  
Reply Fri 18 Jul, 2003 05:24 am
MassDaemon wrote:
Windows XP is still using "Environmental Variables"

Yeah but those aren't designed for use in DOS. forget DOS batch files & just go for windows scripting like inked says. More powerful, more environment variables, & such.

If you don't wanna do that for some reason but still want to use DOS .bat files (and don't want to use two separate ones), let me know & I'll show ya how to pull it off. It's a fair bit more complex though. (involves running a .com file file I can give you which returns errorcodes to check for in your .bat) --- (a windows script inkedmn could write would be a much better method to use, though)
0 Replies
 
enigmafyv
 
  1  
Reply Mon 18 Aug, 2003 09:47 am
Script Progs
Not to steal away from the original question, but is there any way someone could help me make a script that would move all the startup programs, listed in MSconfig, from the "RUN" location to their inactive location. If you need more clarification on this let me know.

Otherwise, if someone could show me the ropes or show me where I can go to learn how to make the script. I'm willing to learn from scratch, and I know it's alot eaiser to make the prog rather than show someone the programming language. Anywho, I apologize again for stealing the attn.
0 Replies
 
Monger
 
  1  
Reply Mon 18 Aug, 2003 11:28 am
Hi enigma,
I don't use WSH, but here is Microsoft's extensive documentation about the scripting host.

Here're a couple other good links for ya..
Hope that helps. Smile
0 Replies
 
Monger
 
  1  
Reply Mon 18 Aug, 2003 12:24 pm
Scripting Guide for Windows wrote:
This example script shows how to read simple values from the Windows registy.

To copy the script paste the following code into a text document and name it regread.vbs
Code:Option Explicit

Dim WSHShell, RegKey, ScreenSaver

Set WSHShell = CreateObject("WScript.Shell")

RegKey = "HKCU\Control Panel\Desktop\"

ScreenSaver = WSHShell.RegRead(RegKey & "SCRNSAVE.EXE")

WScript.echo "Screen Saver: " & ScreenSaver



Obviously code will need to change for writing to the registry's Run locations, but that should show the relative ease of working with the WSH. (that script doesn't change anything it'll just read out your screensaver's filename from the HKCU (Hkey_Current_User) \Control Panel \Desktop \SCRNSAVE.EXE value.)

To change values you'd use WSHShell.RegWrite
0 Replies
 
 

Related Topics

Clone of Micosoft Office - Question by Advocate
Do You Turn Off Your Computer at Night? - Discussion by Phoenix32890
The "Death" of the Computer Mouse - Discussion by Phoenix32890
Windows 10... - Discussion by Region Philbis
Surface Pro 3: What do you think? - Question by neologist
Windows 8 tips thread - Discussion by Wilso
GOOGLE CHROME - Question by Setanta
.Net and Firefox... - Discussion by gungasnake
Hacking a computer and remote access - Discussion by trying2learn
 
  1. Forums
  2. » "Environmental Variables" in batch files
Copyright © 2024 MadLab, LLC :: Terms of Service :: Privacy Policy :: Page generated in 0.04 seconds on 04/29/2024 at 08:47:58