• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1228
  • Last Modified:

Run Login Script Only Once?

Is there a way to run a line of script  in a login script only one time?  I have a database application that I need to update via the network and I want it to happen as the user logs in.
0
Neadom Tucker
Asked:
Neadom Tucker
1 Solution
 
MSE-dwellsCommented:
Sure, do something like this in your script -

:: BEGIN SCRIPT
if not exist "%TEMP%\database.$$$" (
   rem Do your database command[s] here
) else (
   type nul>"%TEMP%\database.$$$"
)
:: END SCRIPT
0
 
Neadom TuckerAuthor Commented:
Well the application is always there.  I have to be able to update the file.
0
 
ajcaruso00Commented:
MSE-dwells was trying to point out that you create a temporary file the first time the user runs the script and then check to see if said file exists before you run the script again don't.  Hence, if not exist, do goodies, otherwise, skip.  Is that not what you are asking? -T
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
MSE-dwellsCommented:
... nod, like ajcaruso00 said - try it out, you should find it does as you ask.
0
 
Neadom TuckerAuthor Commented:
This was never answered.
0
 
b0lsc0ttCommented:
suthngin,

Thanks for your response.  What is the status of this then?  Do you still want to work on it?  The experts responded but you never did.  The expert's suggestion to create a temp file is a common solution to this and should work.  If you would like to provide more info then I will be happy to change my recommendation but with what I read here that is a solution.

If you still need help with this then we can postpone closing this.  Respond to the experts and see if you can get something that will work for you.  If their recommendation isn't clear to you then ask questions.

If you don't need help on this anymore and it didn't work for you then please elaborate.  Post the reason it didn't or what happened when you tried.  If you found another solution then post it here.  I will then change my recommendation, if appropriate, to either delete or PAQ and you will be able to get your points back.

Let me know if you have a question about what I have said.  Without more info I will leave my recommendation as it is but I am definitely willing to reconsider it if you provide more info.

b0lsc0tt
EE Cleanup Volunteer
0
 
MSE-dwellsCommented:
Yes it was answered ... you asked for the syntax that would permit a script to determine that it has already been executed and to prevent any further execution, I provided that -- did you try it?
0

Featured Post

Vote for the Most Valuable Expert

It’s time to recognize experts that go above and beyond with helpful solutions and engagement on site. Choose from the top experts in the Hall of Fame or on the right rail of your favorite topic page. Look for the blue “Nominate” button on their profile to vote.

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