• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 853
  • Last Modified:

GPO Scripts

I have a login script that maps our drives in a GPO.  It's a .bat.  Is there any difference between .bat and .cmd files?  Is one better than the other?

Thanks
0
mchristo63
Asked:
mchristo63
  • 3
  • 2
  • 2
  • +1
1 Solution
 
DVation191Commented:
mchristo63,
Nothing, really. For Win 9x environments scripts need to use the .bat extension. For any NT based OS like 2000 or XP, either one works the same. cmd files are associated with cmd.exe while bat files are associated with command.exe. Since cmd.exe is a 32bit app versus the 16bit command.exe, bat files tend to run faster...though I'm not sure you're running any scripts complicated enough to realized the difference.

0
 
lbbcsgCommented:
.bat == .cmd, according to the REGISTRY
they both mean plain text
now for the other part... cmd is cmdfile and bat is batfile, but looking at where it points to, it is clearly exactly the same... .cmd is just name NT command line program or something, while .bat is a batch script (it's just a name, they both do exactly the same

If you have 2k or XP clients you may consider using .vbs login script to map drives.

Here's a sample:

' 1 Map Drive X All Users
Set objNetwork = CreateObject("WScript.Network")
objNetwork.MapNetworkDrive "X:", "\\server1\images"
0
 
mchristo63Author Commented:
I am not good at .vbs, so hince the .cmd files.  I would like to move toward .vbs, but my mappings are not just X: for all.  I have to map drives based on which AD group they belong.  
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
darkeryuCommented:
hi:

you can find all sample in Microsoft script center..

http://www.microsoft.com/technet/scriptcenter/scripts/default.mspx

all sample easy to use...

thanks
0
 
lbbcsgCommented:
Here's how it would look it .bat format:

IF MEMBER OF "TESTERS" THEN

MAP X:=INPUT:STATUS\UPDATES

END
0
 
mchristo63Author Commented:
Thanks, but I already have a batch file that is mapping based on AD groups.  I just don't kno how to stream line that in a .vbs.  Here is an example of my batch file:

@echo off
REM ##       Sets Variables for Default Server ##

Set Dserver=\\Server
Set D1=U
Set D2=T
Set D3=S

Set S1=%Dserver%\%username%$
Set S2=%Dserver%\applications

REM ##       Deletes S:, T: and U: Mappings. Maps the user home directory and application share ##

net use /persistent:NO
net use %D1%: /delete /y
net use %D2%: /delete /y
net use %D3%: /delete /y

net use %D1%: %S1%
net use %D2%: %S2%

REM ##########       Mapping by Group      ###############################

:DEPT1
\\DC\SysVol\ifmember "Domain\Department 1"
if %errorlevel%==0 goto DEPT2
net use S: \\server\DEPT1 /persistent:no

:DEPT2
\\DC\SysVol\ifmember "Domain\Department 2"
if %errorlevel%==0 goto DEPT3
net use S: \\server\DEPT2 /persistent:no

:DEPT3 ...etc

:End
0
 
DVation191Commented:
The question posted was about the differences between cmd and bat files. Questions about converting these scripts to vbc or wmi are on another topic and should probably be posted in a new thread.
0
 
mchristo63Author Commented:
Yes Sir!
0

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

  • 3
  • 2
  • 2
  • +1
Tackle projects and never again get stuck behind a technical roadblock.
Join Now