Improve company productivity with a Business Account.Sign Up

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1073
  • Last Modified:

MS DOS Set Time

I'm writing a script set_time.sql
the sets a time variable by hosting to dos.

The variable displays the current time the first time the script is called from SQL>@set_time
but when I executed the script again,
the variable stays the same.

My question is how to refresh (clear) the variable
so each time the script is called it displays the new time?

host Set HHMISS=%TIME%
host echo %hhmiss%
0
revxprts
Asked:
revxprts
  • 8
  • 5
1 Solution
 
jdeclueCommented:
do a

host Set HHMISS=
host Set HHMISS=%TIME%
host echo %hhmiss%

This should clear it each time, first.

J
0
 
revxprtsAuthor Commented:
I tried that already--the time did not change.
0
 
jdeclueCommented:
ok just a sec
0
Get expert help—faster!

Need expert help—fast? Use the Help Bell for personalized assistance getting answers to your important questions.

 
jdeclueCommented:
THis is odd... it is working flawlessly for me. What kind of machine are you running on NT/2000/2003?

J
0
 
revxprtsAuthor Commented:
I'm on a Windows 2000 machine, partitioned into C: and D: drives.

=========
set_time.sql
=========
host Set HHMISS=
host echo %hhmiss%

host Set HHMISS=%TIME%
host echo %hhmiss%

=========
=========
D:\> dir
set_time.sql

D:\> sqlplus /nolog
D:\> connect system/passwd
D:\> @set_time

-- time stays the same
0
 
jdeclueCommented:
what happens whe you go to a command prompt and do it manually, are they the same time?

set time=
set time=%TIME%
echo %TIME%

set time=
set time=%TIME%
echo %TIME%
0
 
revxprtsAuthor Commented:
It works fine from the command prompt.
0
 
jdeclueCommented:
the sqlplus is not holding the environment between commands. Can you put this in cmd file and call it?

J
0
 
revxprtsAuthor Commented:
I don't understand
0
 
jdeclueCommented:
Create a text file on d:\time.cmd

Put this in the text file:

@Echo off
Set HHMISS=
Set HHMISS=%TIME%
echo %hhmiss%

then call

host time.cmd

0
 
jdeclueCommented:
So, that worked?

J
0
 
revxprtsAuthor Commented:
You ROCK!
0
 
jdeclueCommented:
Thank you sir ;)

J
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

  • 8
  • 5
Tackle projects and never again get stuck behind a technical roadblock.
Join Now