Need help with batch file...

From: radar64 (hldsadmin_at_rcon.net)
Date: 01/30/05


Date: Sat, 29 Jan 2005 21:43:02 -0800

I am attempting to write a batch file (to be executed at startup) to enable
or disable a given user account based on the current time. My efforts thus
far have resulted in this:

if %time% geq 15:30 if %time% lss 10:00 net user username /active:yes
if %time% geq 10:00 if %time% lss 11:55 net user username /active:no
if %time% geq 11:55 if %time lss 12:35 net user username /active:yes
if %time% geq 12:35 if %time% lss 15:30 net user username /active:no

If the time is from 3:30 PM to before 10:00 AM, or from 11:55 AM to before
12:35 PM, the account should be enabled. If the time is from 9:55 AM to
before 11:55 AM, or from 12:35 PM to before 3:30 PM, the account should be
disabled. In conjunction with a few sheduled tasks, this batch file would
enable the given account to be unavailable to users except at the desired
times, without the restrictions of the '/times' option for the 'net users'
command.
The only problem, naturally, is that the batch file doesn't work. The second
line returns 'net was unexpected at this time', and the last line doesn't
seem to run at all. What am I doing incorrectly?



Relevant Pages

  • Re: Admin problems not letting me play BIA, Halo, Far Cry?
    ... So I'll clutter the forums with this. ... I ran the batch file and sat back and waited ... I reinstalled the gameI am having permissions problems ... it's the default administrator/single user account. ...
    (microsoft.public.windowsxp.games)
  • Re: Fix for: Server Application Unavailable Error after Applying Security Update for IE
    ... I've run the batch file, and now the login is failing for aspnet. ... > Internet Explorer security patch and ASP.NET V1.0 running on Windows XP. ... > Deletes and recreates the ASPNET account with a known temporary password ... This creates a new random password for the account ...
    (microsoft.public.dotnet.framework.aspnet.security)
  • Re: Fix for: Server Application Unavailable Error after Applying Security Update for IE
    ... >> Internet Explorer security patch and ASP.NET V1.0 running on Windows XP. ... >> you can execute the following batch file as a workaround for the issue. ... >> Stops the IIS and ASP.NET state services>> Deletes and recreates the ASPNET account with a known temporary password ...
    (microsoft.public.dotnet.framework.aspnet.security)
  • Re: More fbreseal strange behavior
    ... I worked around it by creating a batch file that executes every ... > different hardware each time. ... > 3) If you try a different SID changed, ... this account lacks the customization that I spent hours ...
    (microsoft.public.windowsxp.embedded)
  • Re: Internet Explorer and index.dats
    ... I use a batch file that runs at boot. ... > So if my user account is reflected in the administrators account, ... >> the internal "Administrator" account. ... >> since if you delete the Temporary Internet Files via the Windows ...
    (microsoft.public.windowsxp.customize)