Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Batch file help.

Status
Not open for further replies.

tinito

Technical User
May 21, 2004
32
GB
Hi all,

i am really new to writing batch files.
was wondering if you could please help me with the following...

scenario is as follows:

my boss has asked me to write/incl some batch code in our login script that must see if a file does NOT exist on a users pc (ie. an exe)

if the file(exe) does NOT exist, it must write the pc hostname to a text file on a server share for him to review.
at the same time, if possible,it must copy the missing file down from the server and if possible pipe out a succesful copy result to another text file.
he mentioned errorlevels to me, which doesnt make much sense to me.

an example of the above scenario would be: c:\winnt\test.exe


hope you guys can help me with this.

regards,
Tinito

 
very tired so may make a few mistakes here :)

IF EXIST c:\test.exe GOTO Next
set >> c:\findinfo.txt
find /i "COMPUTERNAME=" c:\findinfo.txt >> \\server\share\log.txt
del c:\findinfo.txt
\\server\share\log.txt
:Next

just tested...seems to work perfect
it will grab teh computername, right all teh info to the log, and open it when finished....using the >> syntax you can continue to write to the same file

-Brandon Wilson
MCSE00/03, MCSA:Messaging, MCSA03, A+
almost got a paragraph there :)
 
thank you very much.
will try it out and let you know.

io did try and create one in the meantime and it goes like this.

IF NOT EXIST c:\test.exe ECHO %date% %computername% %username% **WSCRIPT NOT PRESENT** >>\\servername\share\tes_not_present.txt
 
that too should do the trick, and much simpler code too

in fact less code is better :)

-Brandon Wilson
MCSE00/03, MCSA:Messaging, MCSA03, A+
almost got a paragraph there :)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top