?
Solved

Check if a file exist in a loginscript

Posted on 1998-12-30
5
Medium Priority
?
966 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
5 Comments
 
LVL 3

Accepted Solution

by:
brosenb0 earned 400 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

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.

Question has a verified solution.

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

This article lists the top 5 free OST to PST Converter Tools. These tools save a lot of time for users when they want to convert OST to PST after their exchange server is no longer available or some other critical issue with exchange server or impor…
Active Directory can easily get cluttered with unused service, user and computer accounts. In this article, I will show you the way I like to implement ADCleanup..
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …
Suggested Courses

741 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