[AccessD] OT: Batch File Syntax - Solved

Darren - Active Billing darren at activebilling.com.au
Tue Sep 19 07:42:35 CDT 2017


Thanks for the quick response Gustav.

 

Yes, the spaces were causing the grief

 

Here’s the final Batch file for anyone who cares.

 

Thank you again, Gustav. Most appreciated.

 

~~~~~~~~~~~~~~~~~~~~~~~~~

@Echo off

cls

 

set ARG1UName=fatso

set ARG2PWD=abc123

set ARG3FullName="Fatty Arbuckle"

set ARG4Comment="General User"

set ARG5Group="General Users Group"

 

net user %ARG1UName% %ARG2PWD% /fullname:%ARG3FullName% /comment:%ARG4Comment% /active:yes /passwordchg:no /expires:never /add

 

WMIC USERACCOUNT WHERE Name='%ARG1UName%' SET PasswordExpires=FALSE

 

NET LOCALGROUP %ARG5Group% %ARG1UName% /ADD

 

pause

~~~~~~~~~~~~~~~~~~~~~~~~~

 

Many thanks.

 

Darren

 

From: AccessD <accessd-bounces at databaseadvisors.com> on behalf of Gustav Brock <gustav at cactus.dk>
Reply-To: Access Developers discussion and problem solving <accessd at databaseadvisors.com>
Date: Tuesday, 19 September 2017 9:05 pm
To: Access Developers discussion and problem solving <accessd at databaseadvisors.com>
Subject: Re: [AccessD] Batch File Syntax

 

Hi Darren

 

No spaces, nor quotes:

 

@Echo off

cls

set ARG1UName=fatso

set ARG2PWD=abc123

set ARG3FullName=Fatty Arbuckle

set ARG4Comment=General User

set ARG5Group=Administrators

 

/gustav

 

-----Oprindelig meddelelse-----

Fra: AccessD [mailto:accessd-bounces at databaseadvisors.com] På vegne af Darren - Active Billing

Sendt: 19. september 2017 08:48

Til: Access Developers discussion and problem solving <accessd at databaseadvisors.com>

Emne: [AccessD] OT: Batch File Syntax

 

Hi guys, 

 

This batch file is not quite working – Syntax is not right. When I type actual values into the “net user” line it works a treat. 

 

Just the setting up of the variables and then having those variables passed to the “net user” line is failing. I’ve tried a lot of variances, this just happens to be the most recent. 

 

~~~~~~~~~~~~~~~~~~~~

 

@Echo off

 

cls

 

set ARG1UName = "fatso"

 

set ARG2PWD = "abc123" 

 

set ARG3FullName = "Fatty Arbuckle"

 

set ARG4Comment = "General User"

 

set ARG5Group = "Administrators"

 

net user %ARG1Uname% %ARG2PWD% /fullname:%ARG3FullName% /comment:%ARG4Comment% /active:yes /passwordchg:no /add

 

pause

 

NET LOCALGROUP %ARG5Group% %ARG1Uname% /ADD

 

pause

 

~~~~~~~~~~~~~~~~~~~~

 

Can anyone assist?

 

Many thanks in advance.

 

Darren 

 

-- 

AccessD mailing list

AccessD at databaseadvisors.com

http://databaseadvisors.com/mailman/listinfo/accessd

Website: http://www.databaseadvisors.com

 



More information about the AccessD mailing list