WshShell.Variable Question 
Author Message
 WshShell.Variable Question

Someone must know this.

Are shell variables all temporary to the session?
Is that why it's called shell scripting and you should use Wsh scripts
if you want to update and store a user variable?
I have a backup log file that increases by one every day.
x=x+1.
The x won't keep it's new value in shell scripting everything seems to
be temporary to the session.  Interactive and script mode react the
same way, in that in a new session the variable updates are lost.

Thanks,

--
F
Ri
Tz

Sent via Deja.com http://www.*-*-*.com/
Before you buy.



Mon, 19 May 2003 03:00:00 GMT  
 WshShell.Variable Question


Quote:
> Someone must know this.

> Are shell variables all temporary to the session?

I assume you mean WSH variables when you say shell variables...

As with most programming environments, variables are stored in memory that
is allocated on a per-instance basis to the running program. When the
program is not running, it has no memory allocated, hence its variable no
longer exist.

Quote:
> Is that why it's called shell scripting and you should use Wsh scripts
> if you want to update and store a user variable?

Shell scripting or WSH (Windows Script Host) scripting? Not sure of your
context.

Quote:
> I have a backup log file that increases by one every day.
> x=x+1.
> The x won't keep it's new value in shell scripting everything seems to
> be temporary to the session.  Interactive and script mode react the
> same way, in that in a new session the variable updates are lost.

Temporary to the session, or no more permanent than the session, take your
pick. If you want certain values to survive between sessions, you have to
put them somewhere where they will be able to persist. This is often done
using files (text, ini, spreadsheets, databases, etc), or the registry.

This may seem a limitation, however I cannot imagine how difficult debugging
would be if variables were as persistent as you seem to want them to be :-)

/Al

Quote:
> Thanks,

> --
> F
> Ri
> Tz

> Sent via Deja.com http://www.deja.com/
> Before you buy.



Tue, 20 May 2003 03:00:00 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. environment variables: wshshell.environment or wshshell.expandenv ironmentstrings?

2. Using variables in WshShell.Run ("....")

3. Using a variable within WshShell object and Run method (newbie at work)

4. WshShell.Run: Spaces in variable

5. WshShell.Run vs WshShell.Exec

6. runas with WshShell.Exec versus WshShell.Run

7. WshShell.Run Question

8. WSHShell.run question

9. WshShell Question

10. WshShell.Run question

11. Passing a variable - simple question - thank you.

12. Variable Substitution Question

 

 
Powered by phpBB® Forum Software