Link to home
Start Free TrialLog in
Avatar of helpdesk_cadth
helpdesk_cadthFlag for Canada

asked on

Creating and copying to a hidden folder

hey guys...

ok.. I'm re-writing all out AD logon batch files.

We have 5 directorates and several specific individual batch files (totaling 40 scripts). When changes occur... such as network drive mappings etc.. it's extremely labor intensive.

As such... I've re-written how things work. I'm now using the "call" command to start other batch files like "drivemap.bat". When a network drive changes.. I can then make the change in one location that is then reflected in all longon batch files.

here is what i'm doing in the "longon" batch files
Mapping network drives
Mapping  network printers
Copying CRM shortcuts to desktop
Verifying that MS Maintenance wizzard has been run.. if not.. run it
copying new Trend Micro antivirus defs
copying "trusted sites" reg file

Now....clearly the first time someone logs in... the batch file takes a while to run. As such.. in an attempt to speed up the process for those that have already gone through the process.. I'm doing the following

Creating two directories
__domain on C:
and
DO_NOT_DELETE in C:\Documents and Settings\%username%\My Documents\

at each step.. I'm checking to see of a specific text file name exists... If not. I copy it to the directory..then run the process..;; like mapping printers
NOTE: the directory i copy to is dependent on if the process is machine or user specific. e.g. I copy the printer text file to the C:\Documents and Settings\%username%\My Documents\DO_NOT_DELETE directory.
Therefore the next time the user logs in.. the script will see that the text file is there.. and move on....
on the flip side.. when i check to see if Maintenance Wizard has been run... I verify the Mainwz text file is in the c:\__domain directory.. I check here because the Maint wiz is machine specific.. not user specific....
(hope i explained that ok.. )

What I want to accomplish is .. I want to make the two directories that I'm creating.. "hidden" (can i use ATTRIB?)... all the while still having them accessable when i need to modify them from within the batch files. Assume that I want to check and verify .... perhaps even copy new text files to the directories..

i know it's long... and thanks for reading..

Any help would be greatly appreciated..

Cheers
example of Main batch
 
 
REM Batch file Maps all network drives
 
echo calling drive batch...
 
REM Call 
Call _DriveMap.bat
 
call __wait.bat
 
REM *************************************************************************************************
 
REM Batch file verifies existence of "__domain" Directory on C:
 
echo Calling local C: directory check...
 
Call __C_DomainCheck.bat
 
call __wait.bat
----------------------------------------------------------
**
Example of Called batch file
**
REM RUN MAINT WIZ on PC
echo.
echo _-_-_-_-_-_-_-_-_-_-_-_-_-_-_-************-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-
echo.
echo Verifying Microsoft Maintenance Wizard setup...
echo.
 
echo.
IF EXIST C:\__domain\maintwiz.txt GOTO CloseCurrent
 
CD C:\__domain
 
copy "\\server-name\ITShare\Computers\Techie section\__SYSVOL Scripts\maintwiz\maintwiz.txt"
echo.
echo MS Maintenance Wizard does not exit.. running setup...
echo.
echo Please select "ok" if prompted...
echo.
echo.
 
"\\cadth-it\ITShare\Computers\Techie section\Software\Microsoft\MaintWiz\maintwiz.exe" /c "\\cadth-IT\ITShare\Computers\Techie section\Software\Microsoft\MaintWiz\outlook2k3_SCRIPT.CMW" /quiet
 
echo _-_-_-_-_-_-_-_-_-_-_-_-_-_-_-************-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-
 
REM *************************************************************************************************
 
:CloseCurrent

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of B.J. Davis
B.J. Davis
Flag of United States of America 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
Avatar of helpdesk_cadth

ASKER

great!!!

one last question..

if the directory already exists on workstations.. how do I set the attrib on that file.. ?

cheers
Just add this to the beginning of your Main Logon Script Batch file

ATTRIB +H c:\__domain
ATTRIB +H C:\Documents and Settings\%username%\My Documents\DO_NOT_DELETE

That way if someone changed it, it will be reset.
If it was NOT changed then the command just re-applies the attribute without errors.



FANTASTIC!!!

thanks!!
Your Welcome and Thank You...