Computing.Net > Forums > Windows NT > Can't stop a file from running in a batc

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

Can't stop a file from running in a batc

Reply to Message Icon

Name: Macadio G.
Date: May 31, 2001 at 09:19:19 Pacific
Comment:

Hello,

Im having trouble trying to get a file to not run each time my login script runs. What happens is I have an if statement that I want to check the local users system for a File called "Audit.txt" and if has a "1" in it then I want the function to terminate,but if it see's "0" or any other number I want it to run a computer audit program that I have running on the server. So far I have not been able to get the batch to skip over running the audit even if the file has a "1" in it. Can some help with this? I will also attach my loginscript batch file. Also the drives arent mapping could this be cause im not running it as a login script but as a batch file or is the syntax incorrect?

Thanks

@echoff

REM For Windows NT users

if '%OS%'=='Windows_NT4'goto nt4
:nt4
:end

REM Setting Environment for 98 users

set os=Windows 98
\\\netlogon\putinenv L/L

echo Hello %USERNAME% welcome to the Network!
echo And you are running the %OS%os

\\\netlogon\sleep 2

REM Maps Network Drives


net use Y: \\\users\%USERNAME%
net use P: \\\public
rem net use Y: /delete
rem net use P: /delete
net use Y: \\\users\%USERNAME%
net use P: \\\public

:pause

REM Function call to Run Audit Program

cd..c:\audit.txt

IF EXIST c:\audit.txt=='1'goto END

:END


ELSE goto AUDIT


:AUDIT

rem \\\TrackIT\Audit32.exe

:END

echo 1> c:\Audit.txt


cls\


:EXIT




Sponsored Link
Ads by Google

Response Number 1
Name: Logan
Date: May 31, 2001 at 10:01:45 Pacific
Reply:

"IF EXIST" tests for the existence of a file, not whether a file contains a string.

Could you change the logic so you use different filenames for success and failure?

IF EXIST AUDIT.1 GOTO...

ECHO 1 > AUDIT.1

Something like that?


0

Response Number 2
Name: Macadio Gaines
Date: May 31, 2001 at 14:20:08 Pacific
Reply:

That won't work cause I have a file number that is pushed into "Audit.txt" I need to know the command or how to figure out, for the system to read the local machine and if it sees the number "1" in a file called "Audit.txt" then it skips running a machine audit and goes to the end of the function. But if it sees a number lower or higher then "1" it runs the audit. Im trying to do this so that I can run quartly audits of all my machines. And I will be manually changing the numbers so that machines don't get audited twice or each time a user logs in. But so far I don't have the correct paramaters and it just keeps running the audit program regardless of what exists in the "Audit.txt" file.


0

Response Number 3
Name: Fabien
Date: June 1, 2001 at 04:49:22 Pacific
Reply:

Try this:

type c:\audit.txt|find /i "0" > NUL
if not errorlevel 1 goto filecontainszero

type c:\audit.txt|find /i "1" > NUL
if not errorlevel 1 goto filecontainsone

Should work. We are using this syntax to skip the logon script for 5000 PCs.


0

Response Number 4
Name: perry
Date: June 1, 2001 at 20:51:40 Pacific
Reply:

On the drive map problem from what you pasted you have 3 \'s it should only be two I believe.

And not sure if it is there or not but I think you may also need a space between the : after the drive letter you want and the first \

Perry


0

Sponsored Link
Ads by Google
Reply to Message Icon

Related Posts

See More







Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Windows NT Forum Home


Sponsored links

Ads by Google


Results for: Can't stop a file from running in a batc

Can't access a patition www.computing.net/answers/windows-nt/cant-access-a-patition-/11686.html

Can't delete a file www.computing.net/answers/windows-nt/cant-delete-a-file/13273.html

can't open office files from expler www.computing.net/answers/windows-nt/cant-open-office-files-from-expler/21504.html