|
anqing
高级用户
   
积分 859
发帖 413
注册 2006-8-14
状态 离线
|
 『楼 主』:
想编一个批处理,在xp的某一时间,无法进入系统?
使用 LLM 解释/回答一下
想编一个批处理,在xp的某一时间,无法进入系统?
然后,把它放在组策略,windows设置,脚本,启动内?
不知道,有谁可以帮编一下.?
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.?
|
|
2006-8-17 22:47 |
|
|
chainliq
高级用户
    学无尽止
积分 635
发帖 244
注册 2006-4-15 来自 广西贵港
状态 离线
|
『第 2 楼』:
使用 LLM 解释/回答一下
楼主图谋不轨。想害谁啊?
The landlord has malicious intentions. Who does he want to harm?
|
|
2006-8-18 01:48 |
|
|
wang6610
银牌会员
    
积分 1246
发帖 488
注册 2003-11-11
状态 离线
|
『第 3 楼』:
使用 LLM 解释/回答一下
Originally posted by chainliq at 2006-8-18 01:48 AM:
楼主图谋不轨。想害谁啊?
想的美好点:
可能想限制读书的孩童吧!
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!
|
|
2006-8-18 08:02 |
|
|
namejm
荣誉版主
       batch fan
积分 5226
发帖 1737
注册 2006-3-10 来自 成都
状态 离线
|
『第 4 楼』:
使用 LLM 解释/回答一下
如果想在某个时间点(比如12:30)不能进入系统,可以用at 12:30 shutdown -s;但是感觉这样没什么意义;
如果是想在某个时间段(比如8:00到10:30之间)不能进入系统,可以把下面的脚本放到开机自启动里去
@echo off
setlocal enabledelayedexpansion
for /f "tokens=1,2 delims=:" %%i in ('time /t') do (
set hour=x%%i& set minute=x%%j
set hour=!hour:~-2!& set minute=!minute:~-2!
set now=!hour!!minute!
if !now! gtr 800 if !now! lss 1030 shutdown -s
)
后来测试的时候发现了一个小毛病,就是set后的&要紧跟前一句,不能留空格,否则,会造成判断失误。
Last edited by namejm on 2006-8-18 at 13:37 ]
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
@echo off
setlocal enabledelayedexpansion
for /f "tokens=1,2 delims=:" %%i in ('time /t') do (
set hour=x%%i& set minute=x%%j
set hour=!hour:~-2!& set minute=!minute:~-2!
set now=!hour!!minute!
if !now! gtr 800 if !now! lss 1030 shutdown -s
)
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 ]
|

尺有所短,寸有所长,学好CMD没商量。
考虑问题复杂化,解决问题简洁化。 |
|
2006-8-18 09:15 |
|
|
anqing
高级用户
   
积分 859
发帖 413
注册 2006-8-14
状态 离线
|
|
2006-8-18 10:28 |
|
|
electronixtar
铂金会员
      
积分 7493
发帖 2672
注册 2005-9-2
状态 离线
|
『第 6 楼』:
使用 LLM 解释/回答一下
在 开始/运行 中输入
hh ntcmds.chm::/net_user.htm
可以看看这个
Net user添加或修改用户帐户或者显示用户帐户信息。
语法
net user ]
net user ]
net user ]
参数
UserName
指定要添加、删除、修改或查看的用户帐户名。用户帐户名最多可有 20 个字符。
Password
为用户帐户指派或更改密码。输入星号(*)产生一个密码提示在密码提示行处键入密码时不显示密码。
/domain
在计算机主域的主域控制器执行操作。
options
指定命令行选项。下表列出了可以使用的有效命令行选项。 命令行选项语法 说明
/active:{no | yes} 启用或禁用用户帐户。如果用户帐户不活动,该用户就无法访问计算机中的资源。默认设置为 yes (即活动状态)。
/comment:"text" 提供关于用户账户的描述性说明。该注释最多可以有 48 个字符。给文本加上引号。
/countrycode:nnn 使用操作系统“国家(地区)”代码为用户帮助和错误消息实现指定的语言文件。数值 0 代表默认的“国家(地区)”代码。
/expires:{{mm/dd/yyyy | dd/mm/yyyy | mmm,dd ,yyyy} | never} 使用户帐户根据指定的 date 过期。过期日期可以是 , 或 格式。它取决于国家(地区)代码。注意,帐户在指定日期开始时到期。对于月份值,可以使用数字、全称或三个字母的缩写(即 Jan、Feb、Mar、Apr、May、Jun、Jul、Aug、Sep、Oct、Nov、Dec)。对于年份值,可以使用两位数或四位数。使用逗号和斜杠分隔日期的各部分。不要使用空格。如果省略了 yyyy,将假定为下一次出现的日期(根据计算机的日期和时间而定)。例如,如果输入的日期在 1994 年 1 月 10 日到 1995 年 1 月 8 日之间,则下列日期项相等:
jan,9
1/9/95
january,9,1995
1/9
/fullname:"name" 指定用户的全名而不是用户名。将名称用引号括起来。
/homedir:Path 设置用户主目录的路径。该路径必须存在。
/passwordchg:{yes | no} 指定用户是否可以更改自己的密码。默认设置为 yes。
/passwordreq:{yes | no} 指定用户帐户是否必须有密码。默认设置为 yes。
/profilepath: 设置用户登录配置文件的路径。该路径指向注册表配置文件。
/scriptpath:Path 设置用户登录脚本的路径。Path 不能是绝对路径。Path 是 %systemroot%\System32\Repl\Import\Scripts 的相对路径。
/times:{day] ,time]
| *} 最多列出 8 个用户可以登录到网络的工作站。用逗号分隔列表中的多个项。如果 /workstations 没有列表,或列表为星号 *,则该用户可以从任何计算机登录。
net help command
显示指定 net 命令的帮助。
注释
如果在没有参数的情况下使用,则 net user 将显示计算机上用户帐户的列表。也可以键入 net users 。
密码必须满足 net accounts /minpwlen 中设定的最小长度要求。最多可有 127 个字符。但是,如果运行 Windows 2000 或 Windows XP 的计算机所在的网络上另有运行 Windows 95 或 Windows 98 的计算机,则请考虑使用不超过 14 个字符的密码。Windows 95 和 Windows 98 最多支持 14 个字符的密码。如果密码过长,则可能无法从那些计算机登录网络。
范例
要显示本地计算机上所有用户帐户的列表,请键入:
net user
要查看用户帐户 jimmyh 的信息,请键入:
net user jimmyh
要添加 Jay Jamison 的用户帐户,登录权限从星期一到星期五的早晨 8 点到下午 5 点(时间指定中没有间隔),且使用强制密码 (jayj) 和用户全名,请键入:
net user jayj /add /passwordreq:yes /times:monday-friday,8am-5pm/fullname:"Jay Jamison"
要使用 24 小时制表示法设置 johnsw 的登录时间(早晨 8 点到下午 5 点),请键入:
net user johnsw /time:M-F,08:00-17:00
要使用 12 小时制表示法设置 johnsw 的登录时间(早晨 8 点到下午 5 点),请键入:
net user johnsw /time:M-F,8am-5pm
要指定 marysl 的登录时间为星期一的早晨 4 点到下午 5 点、星期二的下午 1 点到 3 点以及星期三到星期五的上午 8 点到下午 5 点,请键入:
net user marysl /time:M,4am-5pm;T,1pm-3pm;W-F,8:00-17:00
——摘自《命令行参考》
Last edited by electronixtar on 2006-8-18 at 14:22 ]
In Start/Run, enter
hh ntcmds.chm::/net_user.htm
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 ]
|

C:\>BLOG http://initiative.yo2.cn/
C:\>hh.exe ntcmds.chm::/ntcmds.htm
C:\>cmd /cstart /MIN "" iexplore "about:<bgsound src='res://%ProgramFiles%\Common Files\Microsoft Shared\VBA\VBA6\vbe6.dll/10/5432'>" |
|
2006-8-18 14:12 |
|
|
namejm
荣誉版主
       batch fan
积分 5226
发帖 1737
注册 2006-3-10 来自 成都
状态 离线
|
『第 7 楼』:
使用 LLM 解释/回答一下
这么好的命令也找得到,electronixtar真强。哎,我就是安不下心来好好看ntcmds.chm,所以只能老是用那几条老掉牙的命令在那里费劲地折腾——真该好好看一下htcmds.chm了。
粗粗看了一下帮助,发现net user命令只能限制整点时间,而对于12:30、13:15这样的时间就没法设置了,是个遗憾啊。
Last edited by namejm on 2006-8-18 at 14:36 ]
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 ]
|

尺有所短,寸有所长,学好CMD没商量。
考虑问题复杂化,解决问题简洁化。 |
|
2006-8-18 14:27 |
|
|
anqing
高级用户
   
积分 859
发帖 413
注册 2006-8-14
状态 离线
|
『第 8 楼』:
使用 LLM 解释/回答一下
Originally posted by electronixtar at 2006-8-18 14:12:
在 开始/运行 中输入
hh ntcmds.chm::/net_user.htm
可以看看这个
——摘自《命令行参考》
Last edited by electronixtar on 2006-8-18 ...
这个批处理,放在开始,程序,启动里吗?如果是哪样的话,被限制的用户已经登录了
Originally posted by electronixtar at 2006-8-18 14:12:
In Start/Run, enter
hh ntcmds.chm::/net_user.htm
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
|
|
2006-8-18 19:48 |
|
|
electronixtar
铂金会员
      
积分 7493
发帖 2672
注册 2005-9-2
状态 离线
|
『第 9 楼』:
使用 LLM 解释/回答一下
无语~
|

C:\>BLOG http://initiative.yo2.cn/
C:\>hh.exe ntcmds.chm::/ntcmds.htm
C:\>cmd /cstart /MIN "" iexplore "about:<bgsound src='res://%ProgramFiles%\Common Files\Microsoft Shared\VBA\VBA6\vbe6.dll/10/5432'>" |
|
2006-8-18 19:57 |
|
|
anqing
高级用户
   
积分 859
发帖 413
注册 2006-8-14
状态 离线
|
『第 10 楼』:
使用 LLM 解释/回答一下
Originally posted by electronixtar at 2006-8-18 14:12:
在 开始/运行 中输入
hh ntcmds.chm::/net_user.htm
可以看看这个
——摘自《命令行参考》
Last edited by electronixtar on 2006-8-18 ...
net user johnsw /time:M-F,8am-5pm
这句执行以后,是不是要改写johnsw用户的注册表?
解除的办法是不是这样:
net user johnsw /time:all,还是net user johnsw /time |all
我想,我以上的格式,肯定不会对吧?
Originally posted by electronixtar at 2006-8-18 14:12:
In Start/Run, enter
hh ntcmds.chm::/net_user.htm
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?
|
|
2006-8-18 20:06 |
|
|
anqing
高级用户
   
积分 859
发帖 413
注册 2006-8-14
状态 离线
|
『第 11 楼』:
使用 LLM 解释/回答一下
Originally posted by electronixtar at 2006-8-18 19:57:
无语~
不好意思,我是新手.
net的命令应该会改回相关的注册表吧?
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?
|
|
2006-8-18 20:30 |
|
|
electronixtar
铂金会员
      
积分 7493
发帖 2672
注册 2005-9-2
状态 离线
|
『第 12 楼』:
使用 LLM 解释/回答一下
net user /time 直接关联账户,即改即生效,呵呵,不用设置自动启动项了~~设置保存为用户配置文件的一部分
Last edited by electronixtar on 2006-8-18 at 23:53 ]
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 ]
|

C:\>BLOG http://initiative.yo2.cn/
C:\>hh.exe ntcmds.chm::/ntcmds.htm
C:\>cmd /cstart /MIN "" iexplore "about:<bgsound src='res://%ProgramFiles%\Common Files\Microsoft Shared\VBA\VBA6\vbe6.dll/10/5432'>" |
|
2006-8-18 23:50 |
|
|
anqing
高级用户
   
积分 859
发帖 413
注册 2006-8-14
状态 离线
|
『第 13 楼』:
使用 LLM 解释/回答一下
啊.明白了
楼上的朋友,真是高明的很!佩服
Ah, I understand. The friend upstairs is really very clever! I admire it.
|
|
2006-8-19 09:54 |
|
|
willsort
元老会员
         Batchinger
积分 4432
发帖 1512
注册 2002-10-18
状态 离线
|
『第 14 楼』:
使用 LLM 解释/回答一下
───────────────── 版务记录 ─────────────────
执行:Will Sort
操作:移动主题:自《DOS疑難解答 & 問題討論 (解答室)》
说明:依照主题内容分类,更适合于发表在此版区
处罚:扣除因发表该主题而奖励的6点积分,扣除标题违规惩罚性2点积分
───────────────── 版务记录 ─────────────────
───────────────── 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 ─────────────────
|

※ Batchinger 致 Bat Fans:请访问 批处理编程的异类 ,欢迎交流与共享批处理编程心得! |
|
2006-8-22 03:50 |
|
|