Solved

Check if a file exist in a loginscript

Posted on 1998-12-30
5
957 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
ID: 1594546
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
ID: 1594547
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
ID: 1594548
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
ID: 1594549
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
ID: 1594550
The answer is easy if you know it!

Thank you for your help
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

When converting a physical machine to a virtual machine using VMware vCenter Converter Standalone or vCenter Converter Enterprise, if an adapter type is not selected during the initial customization the resulting virtual machine may contain an IDE d…
Fine Tune your automatic Updates for Ubuntu / Debian
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…
Need to grow your business through quality cloud solutions? With everything required to build a cloud platform and solution, you may feel like the distance between you and the cloud is quite long. Help is here. Spend some time learning about the Con…

932 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

14 Experts available now in Live!

Get 1:1 Help Now