HELP command is not as powerful as man in the *nix world.
登录 | 论坛导航 -> 华新鲜事 -> 技术の宅 | 本帖共有 7 楼,分 1 页, 当前显示第 1 页 : 本帖树形列表 : 刷新 : 返回上一页
<<始页  [1]  末页>>
作者:Flying (等级:18 - 华新水车,发帖:16849) 发表:2004-06-16 10:48:58  楼主  关注此帖
Type help in cmd windowsee the commands and explanantions
HELP command is not as powerful as man in the *nix world.
HELP provides only built-in command's list. But a lot of things in Windows have to be achieved via Win32 API instead.
Flying @way 吳穎暉
欢迎来到华新中文网,踊跃发帖是支持我们的最好方法!原文 / 传统版 / WAP版所有回复从这里展开收起列表
作者:Flying (等级:18 - 华新水车,发帖:16849) 发表:2004-06-16 10:56:47  2楼 评分:
Is there any DOS command to reboot computer ?
What's your OS?
[Got from alt.dos.batch newsgroup:]

DOS/Win3x:
ECHO G=FFFF:0000 | debug

Win9x
rundll user.exe,ExitWindowsExec

Win98/Me
rundll32 shell32.dll,SHExitWindowsEx 2

WinNT/2k (with Resource Kit)
shutdown /L /R /T:0 /Y

WinNT/2k (without Resource Kit)
@ECHO OFF & cd/d %temp% & echo [version] > {out}.inf
(set inf=InstallHinfSection DefaultInstall)
echo signature=$chicago$ >> {out}.inf
echo [defaultinstall] >> {out}.inf
rundll32 setupapi,%inf% 1 %temp%\{out}.inf
del {out}.inf

WinXP
shutdown -r -t 0
欢迎来到华新中文网,踊跃发帖是支持我们的最好方法!原文 / 传统版 / WAP版所有回复从这里展开收起列表
作者:Flying (等级:18 - 华新水车,发帖:16849) 发表:2004-06-16 10:58:52  3楼
actually i am doing vb6.0 proj. any suggestion to reboot?SYNTAX Usage: shutdown [-i | -l | -s | -r | -a] [-f] [-m \\computername] [-t xx] [-c "comment"] [-d up:xx:yy] No args Display this message (same as -?) -i Display GUI interface, must be the first option -l Log off (cannot be used with -m option) -s Shutdown the computer -r Shutdown and restart the computer -a Abort a system shutdown -m \\computername Remote computer to shutdown/restart/abort -t xx Set timeout for shutdown to xx seconds -c "comment" Shutdown comment (maximum of 127 characters) -f Forces running applications to close without warning -d [u] [p]:xx:yy The reason code for the shutdown u is the user code p is a planned shutdown code xx is the major reason code (positive integer less than 256) yy is the minor reason code (positive integer less than 65536) the shutdown -r command has a problem, 30s delay.... i want a immediate restart,just like the restart window after a software installation.both DOS cmd & vb methods are OK.any?
you can use "-t 0" as indicated in my post above.
BTW, this "shutdown" command is available only on WinXP (or Win2k/NT with Resource Kit). So as you are on a VB project, you might actually consider calling the Win32 API instead, which is examplified in the shutdown commands for Win2k/NT as indicated in that post.
欢迎来到华新中文网,踊跃发帖是支持我们的最好方法!原文 / 传统版 / WAP版所有回复从这里展开收起列表
作者:Flying (等级:18 - 华新水车,发帖:16849) 发表:2004-06-16 11:05:37  4楼
thank you! i see, i just want to find an easier method
For VB programming, using the API is actually easier.
You don't have to take care of path, user's OS, etc.
欢迎来到华新中文网,踊跃发帖是支持我们的最好方法!原文 / 传统版 / WAP版所有回复从这里展开收起列表
作者:Flying (等级:18 - 华新水车,发帖:16849) 发表:2004-06-16 11:56:07  5楼
i use ExitWindowsEx , doesnot work? :(
how does your code look like?
API Function
Declare Function ExitWindowsEx Lib "user32" Alias "ExitWindowsEx" (ByVal uFlags As Long, ByVal dwReserved As Long) As Long

use EWX_REBOOT for uFlags.

BTW, the calling process must have SE_SHUTDOWN_NAME privilege in order for this to work.
欢迎来到华新中文网,踊跃发帖是支持我们的最好方法!原文 / 传统版 / WAP版所有回复从这里展开收起列表
作者:Flying (等级:18 - 华新水车,发帖:16849) 发表:2004-06-16 15:35:00  6楼
my code:Const EWX_LOGOFF = 0 Const EWX_SHUTDOWN = 1 Const EWX_REBOOT = 2 Const EWX_FORCE = 4 Private Declare Function ExitWindowsEx Lib "user32" (ByVal uFlags As Long, ByVal dwReserved As Long) As Long Private Sub Form_Load() msg = MsgBox("This program is going to reboot your computer. Press OK to continue or Cancel to stop.", vbCritical + vbOKCancel + 256, App.Title) If msg = vbCancel Then End 'reboot the computer ret& = ExitWindowsEx(EWX_FORCE Or EWX_REBOOT, 0) Unload Me End Sub what is SE_SHUTDOWN_NAME privilege? blur~
Check out the sample code there:
http://www.vbaccelerator.com/home/VB/Tips/How_to_Shutdown_the_System_in_Windows_9x_and_NT/article.asp

Note that there are a lot other stuff in the sample code. But what you should pay attention to is the part there the current process's privilege tokens are checked, and adjusted, in order to enable the process to shutdown the OS.
欢迎来到华新中文网,踊跃发帖是支持我们的最好方法!原文 / 传统版 / WAP版所有回复从这里展开收起列表
作者:Flying (等级:18 - 华新水车,发帖:16849) 发表:2004-06-16 17:38:31  7楼
cool...butWhat is the point of returning a variable if your windows is shutting down? ;) ret& = ExitWindowsEx(EWX_FORCE Or EWX_REBOOT, 0)
The shutdown request may fail.
BTW, as a user-mode process, shutting down is NEVER the last thing the process will do. In most cases, final clean-up should be performed after that, and before your process actually exits.
欢迎来到华新中文网,踊跃发帖是支持我们的最好方法!原文 / 传统版 / WAP版所有回复从这里展开收起列表
论坛导航 -> 华新鲜事 -> 技术の宅 | 返回上一页 | 本主题共有 7 篇文章,分 1 页, 当前显示第 1 页 | 回到顶部
<<始页  [1]  末页>>

请登录后回复:帐号   密码