Showing posts with label network. Show all posts
Showing posts with label network. Show all posts

Thursday, April 25, 2013

Batch File to Send a File to All Computers in Network

Sending a single file to all computers in the network is quite a common task for Windows system administrators. It is handy to have a script that will automate this process. Here is the batch file to send a file to all computers in network:
REM Mass File Sender
REM Sends the specified file to all computers
REM in your network. 


REM Don't forget to replace "compyfile" before
REM executing this script.
SET copyfile=SomeFile.ext
net use S: /delete /y
@net view  | @FOR /F "tokens=1" %%c in ('@find "\\" ') do (
net use S: %%c\c$\bin
COPY %copyfile% S:\ /y
net use S: /delete /y
)

You should just change 'copyfile' to the path to the needful file before executing this script. You should also remember that sending large files can make your network very slow.
We kindly remind that Dr.Batcher is the best program to create batch file, both .BAT and .CMD, try it if haven't tried it yet. 

Saturday, September 17, 2011

Useful Script for Network Backup

Here is an interesting backup script from one of our customers. It requires an external tool to be run, but allows to perform backup from many computers over the network:
@echo off
@set dircmd=/b
set folder=Documents and Settings
for /F "tokens=1 usebackq delims==\ " %%i IN (`net view`) DO (
echo Start copying %%i...
start /wait /min /high robocopy.exe "\\%%i\C$" X:\backup\uim\%%i\C *.doc *.xls /S /R:1 /W:120 /XD RECYCLER batmail "Application Data" game* "Default User" "ÿáí½«¡δ" "Local Settings" windows winxp wxp w2k winnt "Program Files" Temp NetHood Recycled Install "The Bat!" "System Volume Information" readme /XF "~*.*" readme /XJ /XO
start /wait /min /high robocopy.exe "\\%%i\D$" X:\backup\uim\%%i\D *.doc *.xls /S /R:0 /W:1 /XD RECYCLER SCANJET batmail "Application Data" game* "Default User" "ÿáí½«¡δ" "Local Settings" Temp Recycled Install readme/XF "~*.*" "System Volume Information" readme /XJ /XO

Saturday, July 9, 2011

Script for 'Remote Execution' of Programs

It is useful sometimes to download a program from a remote server and run on the computer where the batch script is running. It is not so hard to implement it:
title Loading program... Please wait...
@echo off
net use w: \\192.168.x.x\a1 > nul
echo "1. Disk connected"
cd d:\
d:
md 123
cd d:\123
md Program
copy w:\Prg.exe d:\123\Program\Prog.exe > nul
echo "2. File updated"
start d:\123\Program\Prog.exe > nul
echo "3. Run programm"
net use w: /delete > nul
echo "4. Disk disconnected"
exit

You can change this batch file with help of our award-winning batch files editor. Hope you'll find this example useful.

Friday, June 10, 2011

Batch File to Check Internet Connection

It's useful to create a small batch file that will check your internet connection and restart the computer if there is no connection at the moment. Of course, nobody restricts you to reset the connection parameters or perform any other actions instead of rebooting the computer. You can take the example below and modify it with help of our award-winning batch files editor.
So here is the script to solve the problem described above:
@echo off
ping m-w-c-s.com

if errorlevel 1 shutdown -r -f -t 0
exit
As far as you can see, the way to check the connection is really simple: we just ping Mental Works Computing Software's site and reboot if it is not available. You can use Google or Yahoo! instead if you prefer.

Friday, May 20, 2011

Useful Update for the Previous Blog Post

After publishing the previous blog post, we have received a message with the script that lets one avoid printing all the details of pinging many IP addresses and saying which of them are available instead. It is really a handy and useful script and we decided to share it with the readers of our blog.
@echo off
for /l %%i in (1,1,255) do (
ping -n 1 192.168.1.%%i | findstr "TTL=" 1>nul && (
echo 192.168.1.%%i is UP
) || (
echo 192.168.1.%%i is DOWN
)
)

Tuesday, May 17, 2011

Another Way to Ping Many IPs at Once

We have already discussed how to ping the given list of IP addresses. Now let's look what we can do if this list isn't placed in a text file. As usual, the solution is very simple:
for /L %%i in (1, 1, 255) do ping 192.168.1.%%i
Of course, you have to use your own subnet mask instead of 192.168.1 in the example above. Hope this small script will help you to write your own powerful batch files.

Monday, March 14, 2011

Ping List of IPs

It's pretty easy to ping a single IP with help of standard 'ping' command. But sometimes it's necessary to ping several addresses at once. Unfortunately, ping's syntax doesn't allow you passing the prepared text file as an input parameter to check all IPs listed in it. What to do? Just download Dr.Batcher and start writing really useful script in it.
The script is quite simple. If looks like this:
@echo off
for /f %%i in (test.txt) do ping -n 1 %%i
You can easily enhance it with writing the results of pinging to the text file (log). Input TXT file (test.txt here) should just contain the list of addresses to be pinged, one per line.

Friday, March 4, 2011

Batch File to Open URL

Today I am glad to introduce this short post that should give the answer to a short user's question. The question was "How to open URL via batch file?".
Fortunately, to open URL with the default system browser, you should do almost nothing. The sequence of action looks like this:
1) Start Dr.Batcher and create a new batch script;
2) Switch to Simple mode;
3) Add a new command named "Start a Separate Command Promt" (START);
4) Change the value of parameter 'Command or program to start" to your URL surrounded with commas (for example, "http://www.drbatcher.com");
5) Set other needful parameters;
6) Add more URLs if necessary;
7) Enjoy!

Tuesday, January 25, 2011

Batch File to Retrieve Batch Files from Network Drive and Pack Them


Here is a useful script that administrators can use to retrieve automatically files from the network drive and pack them immediately after that. All the actions are being logged to the LOG file called by default 1.log. You can easily modify this script with help of Dr.Batcher, a powerful utility designed to create and modify batch files.
@echo Starting>> 1.log
@Echo off
@DATE /t >> 1.log
@TIME /T >> 1.log
@echo Copying and logging results ...
@xcopy v:\post\*.doc /z /c /Q >> 1.log
@echo Packing... >> 1.log
@rar a -ag + YYYY:MM:DD:HH:MM \*.doc >> 1.log
@echo Moving the archive to TEMP folder... >> 1.log
@move *.rar TEMP
@echo Removing DOC... >> 1.log
@del /F d:\*.doc
@echo Done... >> 1.log
Have any suggestions on this batch file? Leave your comments!

Thursday, December 30, 2010

Batch File for IP Change


There is a plenty of users that want to change the IP address of a computer with help of batch files. There is a simple way to perform it, all you need is standard netsh command and some imagination to 'invent' a new IP address.
The following line of code will help you to set the IP address and the subnet mask:
netsh int ip set address name = "LAN" source = static addr = 127.0.0.1 mask = 255.255.255.205
Of course, you have to use real IP address instead of samples given above (127.0.0.1 and 255.255.255.205).
Also we advice you to learn netsh command because it's really useful for different networking operations.

Translate