Solved

Check if a file exist in a loginscript

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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone 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

Suggested Solutions

Title # Comments Views Activity
Trusted Applications 1 455
Novel health.log too big 1 343
GroupWise 2012: Set a Recurring Appointment or Edit an Appointment 2 1,144
Novell Client and Windows 7 Unlock Issues 7 1,507
A quick Powershell script I wrote to find old program installations and check versions of a specific file across the network.
Ransomware is a malware that is again in the list of security  concerns. Not only for companies, but also for Government security and  even at personal use. IT departments should be aware and have the right  knowledge to how to fight it.
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

820 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