Solved

Check if a file exist in a loginscript

Posted on 1998-12-30
5
959 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

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

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

Suggested Solutions

Examines three attack vectors, specifically, the different types of malware used in malicious attacks, web application attacks, and finally, network based attacks.  Concludes by examining the means of securing and protecting critical systems and inf…
Google Drive is extremely cheap offsite storage, and it's even possible to get extra storage for free for two years.  You can use the free account 15GB, and if you have an Android device..when you install Google Drive for the first time it will give…
In this video I am going to show you how to back up and restore Office 365 mailboxes using CodeTwo Backup for Office 365. Learn more about the tool used in this video here: http://www.codetwo.com/backup-for-office-365/ (http://www.codetwo.com/ba…
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…

816 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