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\MyFolde r
xcopy d:\Source01\* c:\Inetpub\wwwroot\MyFolde r /s /i
CACLS c:\Inetpub\wwwroot\MyFolde r /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,FUL L
########################## #
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 !
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\MyFolde
xcopy d:\Source01\* c:\Inetpub\wwwroot\MyFolde
CACLS c:\Inetpub\wwwroot\MyFolde
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,FUL
##########################
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
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
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\f iles
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.
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\f
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
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
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 !
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
Steve
ASKER
Sure I will !!
regards
Steve