Solved

Check if a file exist in a loginscript

Posted on 1998-12-30
5
953 Views
Last Modified: 2012-05-04
Is it possible to check if a file exist on the hard drive in a loginscript?
I have tried with an ordinary
"If exist c:\xxx\xxx.xxx goto end" but that did not work.
I have allso tried to do it with :
#command /c if exist c:\xxx\xxx.xxx then set gend=yes
If <gend>="yes" goto end

And that did not work either.
Does anyone have a solution how to do such a check in a
loginscript?
0
Comment
Question by:sverre
  • 2
  • 2
5 Comments
 
LVL 3

Accepted Solution

by:
brosenb0 earned 100 total points
Comment Utility
Use a batch file,

eg. Check.Bat

@Echo Off
If Exist C:\Temp\MyFile.Dat Goto DONE
.
.
.
:DONE


In your login script you simply call the batch file, eg.
#Command /c F:\Login\Check.Bat


0
 
LVL 3

Author Comment

by:sverre
Comment Utility
I have tried with a batchfile but the batchfile did not automaticly close after finnished processing.
Well, thats not the whole truth.
It behaved like this:
When the if statement was fullfilled and he went to the end of batchfile everything worked fine, but when it was not fullfiled it made all copying and some editing off system.ini (with Saber´s iniman) and then the dos window in win95 with client32 that opens in the loginscriptexecutor did not close and the loginscript didi not complete until you closed this window manually.
However, i didn´t use #command /c to execute the batch file.
What i did use was just #g:\xxx\batch, so maybe! but i can´t try before monday the 4:th of january, becasue thats when i start to work again.
Happy New Year!!!!
0
 
LVL 3

Expert Comment

by:brosenb0
Comment Utility
Sverre,

The /c switch tells command.com to exit after it runs the command.  This should cause the dos window to close automatically.
0
 
LVL 4

Expert Comment

by:Zombite
Comment Utility
be aware that with some version of dos that an if exists on a network drive that doesnt exist can cause a lockup. Ok if you are just using a local drive though. Just a point if you are using it.
0
 
LVL 3

Author Comment

by:sverre
Comment Utility
The answer is easy if you know it!

Thank you for your help
0

Featured Post

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

In this article, you will read about the trends across the human resources departments for the upcoming year. Some of them include improving employee experience, adopting new technologies, using HR software to its full extent, and integrating artifi…
In this article, I will show you HOW TO: Create your first Windows Virtual Machine on a VMware vSphere Hypervisor 6.5 (ESXi 6.5) Host Server, the Windows OS we will install is Windows Server 2016.
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…
This tutorial demonstrates a quick way of adding group price to multiple Magento products.

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

7 Experts available now in Live!

Get 1:1 Help Now