中国DOS联盟论坛

China DOS Union

-- Unite DOS · Advance DOS · Grow DOS --
Union site: www.cn-dos.net Forum site: www.cn-dos.net/forum
Guest | Log in | Register | Members | Search | China DOS Union
中国DOS联盟论坛
The time now is 2026-08-12 03:54
47,811 topics / 349,897 posts / today 0 new / 48,256 members
DOS批处理 & 脚本技术(批处理室) » Want to compile a batch script that, at a certain time in XP, prevents access to the system?
Printable Version  2,353 / 13
Floor1 anqing Posted 2006-08-17 22:47
高级用户 Posts 413 Credits 859
Want to compile a batch processing, at a certain time in xp, unable to enter the system?
Then, put it in the group policy, windows settings, scripts, startup inside?
I don't know, can anyone help compile it.?
Floor2 chainliq Posted 2006-08-18 01:48
高级用户 Posts 244 Credits 635 From 广西贵港
The landlord has malicious intentions. Who does he want to harm?
Floor3 wang6610 Posted 2006-08-18 08:02
银牌会员 Posts 488 Credits 1,246
Originally posted by chainliq at 2006-8-18 01:48 AM:
The poster has evil intentions. Who are you trying to harm?


Think more optimistically:
Maybe trying to restrict children who are studying!
Floor4 namejm Posted 2006-08-18 09:15
荣誉版主 Posts 1,737 Credits 5,226 From 成都
If you want to be unable to enter the system at a certain point in time (such as 12:30), you can use "at 12:30 shutdown -s"; but it feels meaningless like this;

If you want to be unable to enter the system during a certain time period (such as between 8:00 and 10:30), you can put the following script into the startup to start with the computer


Later, when testing, a small problem was found, that is, the & after set should be closely followed by the previous sentence, and no space should be left, otherwise, it will cause judgment errors.

[ Last edited by namejm on 2006-8-18 at 13:37 ]
Floor5 anqing Posted 2006-08-18 10:28
高级用户 Posts 413 Credits 859
Thanks to the friend in the previous post.
I'm a newbie. Could you explain the batch file above and note what each line does?
Floor6 electronixtar Posted 2006-08-18 14:12
铂金会员 Posts 2,672 Credits 7,493
In Start/Run, enter


You can take a look at this


Net user adds or modifies user accounts or displays user account information.

Syntax
net user ]

net user ]

net user ]

Parameters
UserName
Specifies the user account name to add, delete, modify, or view. The user account name can have up to 20 characters.
Password
Assigns or changes the password for the user account. Enter an asterisk (*) to generate a password prompt. The password is not displayed when typing at the password prompt line.
/domain
Performs the operation on the primary domain controller of the computer's primary domain.
options
Specifies command-line options. The following table lists the valid command-line options that can be used. Command-line option syntax Description
/active:{no | yes} Enables or disables the user account. If the user account is inactive, the user cannot access resources in the computer. The default setting is yes (that is, active).
/comment:"text" Provides a descriptive description of the user account. This comment can have up to 48 characters. Enclose the text in quotes.
/countrycode:nnn Uses the operating system "country/region" code to implement the specified language file for user help and error messages. The value 0 represents the default "country/region" code.
/expires:{{mm/dd/yyyy | dd/mm/yyyy | mmm,dd ,yyyy} | never} Expires the user account according to the specified date. The expiration date can be in , or format. It depends on the country/region code. Note that the account expires at the start of the specified date. For the month value, you can use numbers, full names, or three-letter abbreviations (that is, Jan, Feb, Mar, Apr, May, Jun, Jul, Aug, Sep, Oct, Nov, Dec). For the year value, you can use two-digit or four-digit numbers. Use commas and slashes to separate the parts of the date. Do not use spaces. If yyyy is omitted, the next occurrence date (depending on the computer's date and time) will be assumed. For example, if the entered date is between January 10, 1994 and January 8, 1995, the following date items are equal:
jan,9
1/9/95
january,9,1995
1/9

/fullname:"name" Specifies the full name of the user instead of the user name. Enclose the name in quotes.
/homedir:Path Sets the path of the user's home directory. This path must exist.
/passwordchg:{yes | no} Specifies whether the user can change their own password. The default setting is yes.
/passwordreq:{yes | no} Specifies whether the user account must have a password. The default setting is yes.
/profilepath: Sets the path of the user's login profile. This path points to the registry profile.
/scriptpath:Path Sets the path of the user's login script. Path cannot be an absolute path. Path is a relative path of %systemroot%\System32\Repl\Import\Scripts.
/times:{day] ,time]

| *} Lists up to 8 workstations where the user can log in to the network. Separate multiple items in the list with commas. If there is no list for /workstations or the list is an asterisk *, the user can log in from any computer.

net help command
Displays help for the specified net command.
Remarks
If used without parameters, net user will display a list of user accounts on the computer. You can also type net users.
The password must meet the minimum length requirement set in net accounts /minpwlen. It can have up to 127 characters. However, if the computer running Windows 2000 or Windows XP is on a network with other computers running Windows 95 or Windows 98, please consider using a password of no more than 14 characters. Windows 95 and Windows 98 support passwords of up to 14 characters. If the password is too long, it may not be possible to log in to the network from those computers.
Examples
To display a list of all user accounts on the local computer, type:

net user

To view information about the user account jimmyh, type:

net user jimmyh


To add a user account for Jay Jamison, with login permissions from 8:00 AM to 5:00 PM from Monday to Friday (no intervals in the time specification), and using a forced password (jayj) and full user name, type:

net user jayj /add /passwordreq:yes /times:monday-friday,8am-5pm/fullname:"Jay Jamison"

To set the login time for johnsw using 24-hour time notation (8:00 AM to 5:00 PM), type:

net user johnsw /time:M-F,08:00-17:00

To set the login time for johnsw using 12-hour time notation (8:00 AM to 5:00 PM), type:

net user johnsw /time:M-F,8am-5pm

To specify the login time for marysl as 4:00 AM to 5:00 PM on Monday, 1:00 PM to 3:00 PM on Tuesday, and 8:00 AM to 5:00 PM from Wednesday to Friday, type:

net user marysl /time:M,4am-5pm;T,1pm-3pm;W-F,8:00-17:00



——Excerpted from "Command Line Reference"

[ Last edited by electronixtar on 2006-8-18 at 14:22 ]
Floor7 namejm Posted 2006-08-18 14:27
荣誉版主 Posts 1,737 Credits 5,226 From 成都
Such a good command can be found, electronixtar is really powerful. Hey, I just can't settle down to read ntcmds.chm carefully, so I can only always struggle with those old - fashioned commands there - I really should read htcmds.chm carefully.

After a rough look at the help, I found that the net user command can only limit the whole - hour time, and it can't set times like 12:30, 13:15, which is a pity.

[ Last edited by namejm on 2006 - 8 - 18 at 14:36 ]
Floor8 anqing Posted 2006-08-18 19:48
高级用户 Posts 413 Credits 859
Originally posted by electronixtar at 2006-8-18 14:12:
In Start/Run, enter


You can take a look at this



——Excerpted from "Command Line Reference"

[ Last edited by electronixtar on 2006-8-18 ...




Is this batch file placed in Start, Programs, Startup? If so, then the restricted user has already logged in
Floor9 electronixtar Posted 2006-08-18 19:57
铂金会员 Posts 2,672 Credits 7,493
Speechless~
Floor10 anqing Posted 2006-08-18 20:06
高级用户 Posts 413 Credits 859
Originally posted by electronixtar at 2006-8-18 14:12:
In Start/Run, enter


You can take a look at this



——Excerpted from "Command Line Reference"

[ Last edited by electronixtar on 2006-8-18 ...



After executing the command `net user johnsw /time:M-F,8am-5pm`, does it need to rewrite the registry of the johnsw user?
Is the way to解除 it like this:
`net user johnsw /time:all`, or `net user johnsw /time |all`
I think the format I mentioned above is definitely not correct, right?
Floor11 anqing Posted 2006-08-18 20:30
高级用户 Posts 413 Credits 859
Originally posted by electronixtar at 2006-8-18 19:57:
Speechless~




I'm sorry, I'm a newbie.
Does the net command should revert related registry?
Floor12 electronixtar Posted 2006-08-18 23:50
铂金会员 Posts 2,672 Credits 7,493
net user /time directly associates with the account, takes effect immediately, heh, no need to set up auto-start items~~ The settings are saved as part of the user profile

[ Last edited by electronixtar on 2006-8-18 at 23:53 ]
Floor13 anqing Posted 2006-08-19 09:54
高级用户 Posts 413 Credits 859
Ah, I understand. The friend upstairs is really very clever! I admire it.
Floor14 willsort Posted 2006-08-22 03:50
元老会员 Posts 1,512 Credits 4,432

───────────────── Moderation Record ─────────────────
Performed by: Will Sort
Operation: Move topic: From "DOS Troubleshooting & Problem Discussion (Q&A Room)"
Description: According to the topic content classification, it is more suitable to be posted in this forum area
Punishment: Deduct 6 points of reward points for posting this topic, deduct 2 points of penalty points for title violation
───────────────── Moderation Record ─────────────────
[ Contact the Union admin team - 中国DOS联盟 - Standard version ]
Sponsored by ifanr Inc | © 2001–2023