From: Hemal on 3 Mar 2010 10:00 Hi Everyone, I am new to batch file programming and need an expert help to find out something. I want to create a batch file that runs at login and compares a local copy of the templates to what we have on the network. We have templates on a mapped network drive in h:\clients\templates, and on the laptop in c:\apps\data\clients\templates. When the laptop is offline it substitutes c:\apps\data to appear as h: drive, that way the files appear to be in h:\clients\templates. Here's the basic steps what I need the batch file for: 1. first it checks to see if the computer is on the network 2. if it's online it copies any newer files from Server onto the local drive 3. if it's not online it uses the local files and has them show up on the laptop as the same location as the network I really appreciate any help/suggestions.. Thank you in advance, Hemal
From: Pegasus [MVP] on 3 Mar 2010 10:23 "Hemal" <Hemal(a)discussions.microsoft.com> wrote in message news:81371A3E-013B-4768-8007-4AC4B1348564(a)microsoft.com... > Hi Everyone, > > I am new to batch file programming and need an expert help to find out > something. I want to create a batch file that runs at login and compares a > local copy of the templates to what we have on the network. We have > templates > on a mapped network drive in h:\clients\templates, and on the laptop in > c:\apps\data\clients\templates. When the laptop is offline it substitutes > c:\apps\data to appear as h: drive, that way the files appear to be in > h:\clients\templates. Here's the basic steps what I need the batch file > for: > > 1. first it checks to see if the computer is on the network > 2. if it's online it copies any newer files from Server onto the local > drive > 3. if it's not online it uses the local files and has them show up on the > laptop as the same location as the network > > I really appreciate any help/suggestions.. > > Thank you in advance, > Hemal This is really a VB Script newsgroup but since your query is fairly simple, here is a sample batch file: @echo off ping aaa.bbb.ccc.ddd -n 2 > nul if %ErrorLevel% EQU 0 ( xcopy /d /y h:\clients\templates c:\apps\data\clients\templates > nul ) else ( subst h: c:\apps\data ) Please note: - You should type xcopy /? at the Command Prompt to familiarise yourself with the many switches that xcopy offers. - You must replace aaa.bbb.ccc.ddd with the server's correct IP address.
From: Al Dunbar on 4 Mar 2010 22:38 "Pegasus [MVP]" <news(a)microsoft.com> wrote in message news:u#OF7VuuKHA.4464(a)TK2MSFTNGP04.phx.gbl... > > > "Hemal" <Hemal(a)discussions.microsoft.com> wrote in message > news:81371A3E-013B-4768-8007-4AC4B1348564(a)microsoft.com... >> Hi Everyone, >> >> I am new to batch file programming and need an expert help to find out >> something. I want to create a batch file that runs at login and compares >> a >> local copy of the templates to what we have on the network. We have >> templates >> on a mapped network drive in h:\clients\templates, and on the laptop in >> c:\apps\data\clients\templates. When the laptop is offline it substitutes >> c:\apps\data to appear as h: drive, that way the files appear to be in >> h:\clients\templates. Here's the basic steps what I need the batch file >> for: >> >> 1. first it checks to see if the computer is on the network >> 2. if it's online it copies any newer files from Server onto the local >> drive >> 3. if it's not online it uses the local files and has them show up on the >> laptop as the same location as the network >> >> I really appreciate any help/suggestions.. >> >> Thank you in advance, >> Hemal > > This is really a VB Script newsgroup but since your query is fairly > simple, here is a sample batch file: > > @echo off > ping aaa.bbb.ccc.ddd -n 2 > nul > if %ErrorLevel% EQU 0 ( > xcopy /d /y h:\clients\templates c:\apps\data\clients\templates > nul > ) else ( > subst h: c:\apps\data > ) > > Please note: > - You should type xcopy /? at the Command Prompt to familiarise yourself > with the many switches that xcopy offers. > - You must replace aaa.bbb.ccc.ddd with the server's correct IP address. .... or with the name of the server... I have done it this way: if exist "H:\clients\templates" ( xcopy /d /y h:\clients\templates c:\apps\data\clients\templates > nul ) else ( subst h: c:\apps\data ) /Al
|
Pages: 1 Prev: ShellExecute question Next: Option Explicit in .wsf and .asp files |