Link to home
Start Free TrialLog in
Avatar of NetMaxtor
NetMaxtor

asked on

Windows batch scripting path referral file ?

Hi Experts,

I was writing a simple batch file and I need to get the resource paths in to one separate file.


###########################
echo off
mkdir c:\Inetpub\wwwroot\MyFolder
xcopy d:\Source01\* c:\Inetpub\wwwroot\MyFolder /s /i
CACLS c:\Inetpub\wwwroot\MyFolder /E /T /C /G server01\ASPNET:F                        

mkdir d:\Folder01
mkdir d:\Folder01\Sub01
mkdir d:\Folder01\Sub02
mkdir d:\Folder01\Sub03
xcopy d:\Source02\* d:\Folder01 /s /i
CACLS d:\Folder01 /E /T /C /G server01\ASPNET:F server01\User01:F
NET SHARE Share01$=d:\Folder01 /grant:server01\User01,FULL
###########################

Likewise this script may be bit long. I need to make a resource path referrals file. In the referral file, at least I need to change Source01 and Source02 folder location. Hope you got my point? How do I make this happen, please advice!

Thanks !
ASKER CERTIFIED SOLUTION
Avatar of Steve Knight
Steve Knight
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
or if you want to just store the path in the resource file (like an INI file) then we can extract it with some FOR commands.  Let me know.

regards

Steve
If you think that's a bit long, you should see my backup script.

To elaborate on what steve is referring to, create a text file called "sources.txt" (or whatever, but replace the name as appropriate below).  Each line should be like:

Source01=x:\path\to\your\files

Then use for to extract the names.

For /f "tokens=2, delims==" %%a in (sources.txt) do SET Source01=%%a

Repeat as necessary for as many sources as you need.
Yeah that was what I was suggesting, was on the way out before...

By the time you add edit history, comments, error checking, email alerts and everything else to 'production' scripts 3-4 pages or more when printed isn't unusual.... and frankly if written right is perfectly maintainable.

Steve
Avatar of NetMaxtor
NetMaxtor

ASKER

dragon-it: it works well !! thanks a lot !!

leew: tnx to you too !

Steve: since you guys are experts on scripting, I would like to have some additional clues;

1. Restore IIS .xml file to a IIS 6 on Windows 2003 ? Configs on IIS virtual web site ?
2. Can I restore a MS-SQL DB using batch script?
3. Create a Windows Media server instant and do some configs ?

Basically I'm trying to make automated deployment of a IIS application.

Any ideas would be greatly appreciated !



To keep it clean I suggest you raise some new questions for that /those.  Will pickup and look at it later for you then if someone else doesn;t get there first.

Steve
Sure I will !!