Skip to main content

hi all need a lil help with batch files

More
18 years 4 months ago #15490 by nibsa
Replied by nibsa on topic thanks
thanks for all of you guy's help but sorry for bugging you guys again but it will not working even with


@echo off
netstat -[options] >> whateverfile.txt


i can see that netstat does start but the cmd window is closeing realy fast i say less then a sec
More
18 years 4 months ago #15494 by TheBishop
Replied by TheBishop on topic Batch file
The window closes when the commands in the batch file have all executed; just because the window closes quickly doesn't mean your output file hasn't been written.
The commands given so far should do what you want, but if you want to check then simply add 'pause' (without the quotes) as the last line in your batch file. The window will then sit on the screen until you press a key, which will allow you to read any messages
More
18 years 4 months ago #15507 by nibsa
Replied by nibsa on topic Re: Batch file

The window closes when the commands in the batch file have all executed; just because the window closes quickly doesn't mean your output file hasn't been written.
The commands given so far should do what you want, but if you want to check then simply add 'pause' (without the quotes) as the last line in your batch file. The window will then sit on the screen until you press a key, which will allow you to read any messages




i just want to say thats to every one here for helping me out with with but bishop you helped me out alot there thanks . that seems to work tight is will go well with my lil anispyware proggram
More
18 years 4 months ago #15510 by nekkanti
Replied by nekkanti on topic Batch file creation
Hi

Type the following or cut and paste this in notepad and save as Filename.cmd.when you run this cmd file it will create test1.txt file in D drive of your pc.you can specify the drive location or path what ever you want in cmd.I hope it will solve your problem

Echo off
cls
echo ************************************************************
echo * For storing the Network log
echo * Please do not disturb
Echo **********************
Netstat -ne >> d:\tets1.txt
More
18 years 4 months ago #15531 by nibsa
Replied by nibsa on topic Re: Batch file creation

Hi

Type the following or cut and paste this in notepad and save as Filename.cmd.when you run this cmd file it will create test1.txt file in D drive of your pc.you can specify the drive location or path what ever you want in cmd.I hope it will solve your problem

Echo off
cls
echo ************************************************************
echo * For storing the Network log
echo * Please do not disturb
Echo **********************
Netstat -ne >> d:\tets1.txt



thats tight to know i already tryed it and it works good thanks alot im always happy to learn :)
More
18 years 4 months ago #15533 by TheBishop
Replied by TheBishop on topic Batch files
While we're on the subject of batch files, one problem with them is the poor support for conditional prcessing. For example, the concept of 'IF [condition] THEN [do this] OR [do something else]' isn't supported. But there are things you can do - clunky, nasty things admittedly but they can work for you if you bear in mind their limitations. One idea is to use the existence or absence of a file to affect what the batchfile does. For example, say you have a batchfile called 'job2' that must do something only if a previous batchfile (job1) has already run. In job1, when the processing has been done, create a file called flagfile.txt and then exit. Now when job2 runs you can use the 'IF EXIST' keywords to do whatever follows on that line if, and only if, flagfile.txt is present. And once the task is completed you could delete flagfile.txt so it happens just the once even if job2 is run again. The weakness in this mechanism, and the ting you have to bear in mind, is disk write caching - just because your script creates the flagfile doesn't mean it physically exists on the disk yet. That might take quite a few seconds if your machine is busy, so bear that in mind
Time to create page: 0.149 seconds