• RSS
  • Twitter
  • FaceBook

Security Forums

Log in

FAQ | Usergroups | Profile | Register | RSS | Posting Guidelines | Recent Posts

Batch file question

Users browsing this topic:0 Security Fans, 0 Stealth Security Fans
Registered Security Fans: None
Post new topic   Reply to topic   Printer-friendly version    Networking/Security Forums Index -> Programming and More

View previous topic :: View next topic  
Author Message
Sgt_B
Trusted SF Member
Trusted SF Member


Joined: 28 Oct 2002
Posts: 16777215
Location: Chicago, IL US

Offline

PostPosted: Wed Nov 20, 2002 7:18 pm    Post subject: Batch file question Reply with quote

We have a script that runs, and we want to write the output of that batch file into a log file. As of right now the script runs, and writes to the log file. We'd like to have the script create a new file if previous log file exists.
Example:
Script runs, writes to log.log
Script runs again, sees that log.log already exists, so it writes to log1.log (log2.log, log3.log etc.)

What can I do to get this done?

Thanks!

Running NT SP6a.
Back to top
View user's profile Send private message Visit poster's website
TheKingster
Link Spammer
Link Spammer


Joined: 03 May 2002
Posts: 0
Location: UK

Offline

PostPosted: Wed Nov 20, 2002 7:22 pm    Post subject: Reply with quote

%logfile% = log.log
if exist %logfile% then %logfile% = log1.log

THEN PUT


>> %logfile% at the end of the lines you want to log to.

The first line has to be > though so it creates the new file as >> is append to the end.
Back to top
View user's profile Send private message
ShaolinTiger
Forum Fanatic
Forum Fanatic


Joined: 18 Apr 2002
Posts: 16777215
Location: Kuala Lumpur, Malaysia

Offline

PostPosted: Wed Nov 20, 2002 7:29 pm    Post subject: Reply with quote

Yeh and do it like log1.log to log9.log, then if log9.log exists
zip.exe log1.log, log2.log, log3.log etc to %DATE%-archive.zip or something like that.

Then it will continuosly run without taking up too much space and will archive all old logs in a neat zip file.
Back to top
View user's profile Send private message Visit poster's website
browolf
Trusted SF Member
Trusted SF Member


Joined: 19 Apr 2002
Posts: 1


Offline

PostPosted: Fri Nov 22, 2002 7:08 pm    Post subject: Reply with quote

Sgt_B wrote:
Hey thanks alot! I like the zip thing...didn't even cross my mind. Very Happy


have u thought of using wsh?
possibilities abound with more power.


~andy
Back to top
View user's profile Send private message
ShaolinTiger
Forum Fanatic
Forum Fanatic


Joined: 18 Apr 2002
Posts: 16777215
Location: Kuala Lumpur, Malaysia

Offline

PostPosted: Fri Nov 22, 2002 7:08 pm    Post subject: Reply with quote

Or even better kixstart apparently...
Back to top
View user's profile Send private message Visit poster's website
Sgt_B
Trusted SF Member
Trusted SF Member


Joined: 28 Oct 2002
Posts: 16777215
Location: Chicago, IL US

Offline

PostPosted: Fri Nov 22, 2002 11:44 pm    Post subject: Reply with quote

C1 - No not CW.

ST - We have kixstart, but I have no idea what to do with it. Logon scripts are as far as I've gotten. Very Happy I have the manual in my desk somewhere though...collecting dust no doubt.

Browulf - Whats wsh? Haven't heard of it before.
Back to top
View user's profile Send private message Visit poster's website
hads
Trusted SF Member
Trusted SF Member


Joined: 23 May 2002
Posts: 3
Location: New Zealand

Offline

PostPosted: Mon Nov 25, 2002 4:02 am    Post subject: Reply with quote

WSH == Windows Script Host

i.e. Scripting using VBScript or Javascript. Whist running under the script host they have vastly more power than when used for the web (thank f**k) e.g. Network operations, File operations etc. etc.

/edit: Need to go to spelling school


Last edited by hads on Mon Nov 25, 2002 11:07 am; edited 1 time in total
Back to top
View user's profile Send private message
enigman
Just Arrived
Just Arrived


Joined: 09 Oct 2002
Posts: 0
Location: Sydney

Offline

PostPosted: Mon Nov 25, 2002 10:32 am    Post subject: Reply with quote

hads wrote:
WSH == Windows Script Host

i.e. Scripting using VBScript of Javascript. Whist running under the script host they have vastly more power than when used for the web (thank f**k) e.g. Network operations, File operations etc. etc.


Too right it's got more power. I wrote a WSH/HTML app for our Win2K rollout that enumerated the printers for our different sites, gave the user a list of printers to choose from then would map the printers for them.

We don't use it for login scripts as most of our admins are more familiar with batch files, KixTart etc than VBScript etc.

Enigman
----------
Do the voices in my head bother you?
Back to top
View user's profile Send private message Visit poster's website Yahoo Messenger MSN Messenger
Display posts from previous:   

Post new topic   Reply to topic   Printer-friendly version    Networking/Security Forums Index -> Programming and More All times are GMT + 2 Hours
Page 1 of 1


 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

Looking for more Windows Networking info?

Sign up to the WindowsNetworking.com Monthly Newsletter, written by Enterprise Security MVP Deb Shinder, containing news, the hottest tips, Networking links of the month and much more. Subscribe today and don't miss a thing!
View a sample newsletter.

Become a WindowsNetworking.com member!

Discuss your Windows Networking issues with thousands of other Windows Newtorking experts. Click here to join!

Community Area

Log in | Register

Readers' Choice

Which is your preferred data recovery solution?

Follow TechGenix on Twitter