2010年8月15日
原文地址: http://technet.microsoft.com/en-us/sysinternals/bb897553.aspx
Utilities like Telnet and remote control programs like Symantec's PC Anywhere let you execute programs on remote systems, but they can be a pain to set up and require that you install client software on the remote systems that you wish to access. PsExec is a light-weight telnet-replacement that lets you execute processes on other systems, complete with full interactivity for console applications, without having to manually install client software. PsExec's most powerful uses include launching interactive command-prompts on remote systems and remote-enabling tools like IpConfig that otherwise do not have the ability to show information about remote systems.
Note: some anti-virus scanners report that one or more of the tools are infected with a "remote admin" virus. None of the PsTools contain viruses, but they have been used by viruses, which is why they trigger virus notifications.
Installation
Just copy PsExec onto your executable path. Typing "psexec" displays its usage syntax.
Using PsExec
See the July 2004 issue of Windows IT Pro Magazine for Mark's article that covers advanced usage of PsExec.
Usage: psexec [\\computer[,computer2[,...] | @file][-u user [-p psswd]][-n s][-l][-s|-e][-x][-i [session]][-c [-f|-v]][-w directory][-d][-<priority>][-a n,n,... ] cmd [arguments]
| computer | Direct PsExec to run the application on the computer or computers specified. If you omit the computer name PsExec runs the application on the local system and if you enter a computer name of "\\*" PsExec runs the applications on all computers in the current domain. |
| @file | Directs PsExec to run the command on each computer listed in the text file specified. |
| -a | Separate processors on which the application can run with commas where 1 is the lowest numbered CPU. For example, to run the application on CPU 2 and CPU 4, enter: "-a 2,4" |
| -c | Copy the specified program to the remote system for execution. If you omit this option then the application must be in the system's path on the remote system. |
| -d | Don't wait for application to terminate. Only use this option for non-interactive applications. |
| -e | Does not load the specified account's profile. |
| -f | Copy the specified program to the remote system even if the file already exists on the remote system. |
| -i | Run the program so that it interacts with the desktop of the specified session on the remote system. If no session is specified the process runs in the console session. |
| -l | Run process as limited user (strips the Administrators group and allows only privileges assigned to the Users group). On Windows Vista the process runs with Low Integrity. |
| -n | Specifies timeout in seconds connecting to remote computers. |
| -p | Specifies optional password for user name. If you omit this you will be prompted to enter a hidden password. |
| -s | Run remote process in the System account. |
| -u | Specifies optional user name for login to remote computer. |
| -v | Copy the specified file only if it has a higher version number or is newer on than the one on the remote system. |
| -w | Set the working directory of the process (relative to the remote computer). |
| -x | Display the UI on the Winlogon desktop (local system only). |
| -priority | Specifies -low, -belownormal, -abovenormal, -high or -realtime to run the process at a different priority. Use -background to run at low memory and I/O priority on Vista. |
| program | Name of the program to execute. |
| arguments | Arguments to pass (note that file paths must be absolute paths on the target system) |
You can enclose applications that have spaces in their name with quotation marks e.g. "psexec \\marklap "c:\long name\app.exe". Input is only passed to the remote system when you press the enter key, and typing Ctrl-C terminates the remote process.
If you omit a username the remote process runs in the same account from which you execute PsExec, but because the remote process is impersonating it will not have access to network resources on the remote system. When you specify a username the remote process executes in the account specified, and will have access to any network resources the account has access to. Note that the password is transmitted in clear text to the remote system.
Examples
This article I wrote describes how PsExec works and gives tips on how to use it:
http://www.winnetmag.com/Windows/Issues/IssueID/714/Index.html
The following command launches an interactive command prompt on \\marklap:
psexec \\marklap cmd
This command executes IpConfig on the remote system with the /all switch, and displays the resulting output locally:
psexec \\marklap ipconfig /all
This command copies the program test.exe to the remote system and executes it interactively:
psexec \\marklap -c test.exe
Specify the full path to a program that is already installed on a remote system if its not on the system's path:
psexec \\marklap c:\bin\test.exe
Run Regedit interactively in the System account to view the contents of the SAM and SECURITY keys::
psexec -i -d -s c:\windows\regedit.exe
To run Internet Explorer as with limited-user privileges use this command:
psexec -l -d "c:\program files\internet explorer\iexplore.exe"
这篇文章主要介绍了相比于python2.6,python3.0的新特性。更详细的介绍请参见python3.0的文档。
Common Stumbling Blocks
本段简单的列出容易使人出错的变动。
- print语句被print()函数取代了,可以使用关键字参数来替代老的print特殊语法。例如:
- Old: print "The answer is", 2*2
- New: print("The answer is", 2*2)
- Old: print x, # 使用逗号结尾禁止换行
- New: print(x, end=" ") # 使用空格代替换行
- Old: print # 输出新行
- New: print() # 输出新行
- Old: print >>sys.stderr, "fatal error"
- New: print("fatal error", file=sys.stderr)
- Old: print (x, y) # 输出repr((x, y))
- New: print((x, y)) # 不同于print(x, y)!
你可以自定义输出项之间的分隔符:
print("There are <", 2**32, "> possibilities!", sep="")
输出结果是:
There are <4294967296> possibilities!
注意:
- print()函数不支持老print语句的“软空格”特性,例如,在python2.x中,print "A\n", "B"会输出"A\nB\n",而python3.0中,print("A\n", "B")会输出"A\n B\n"
- 学会渐渐习惯print()吧!
- 使用2to3源码转换工具时,所有的print语句被自动转换成print()函数调用,对大项目,这是无需争论的。
- python3.0使用字符串(strings)和bytes代替Unicode字符串和8位字符串,这意味着几乎所有使用Unicode编码和二进制数据的代码都要改动。这个改动很不错,在2.x的世界里,无数的bug都是因为编码问题。
- map()和filter()返回迭代器(iterators)
- dict方法keys(),items(),values()返回视图(同样是迭代器)而不是列表(list)
- 内建的sorted()方法和list.sort()方法不再接受表示比较函数的cmp参数,使用key参数代替。
- 1/2返回浮点数,使用1//2能得到整数。
- repr()函数对于long整数不再包含拖尾的L,所以不加判断的去除最后一个字符会导致去掉一个有用的数字。
String and Bytes
- 现在只有一种字符串:str,它的行为和实现都很像2.x的unicode串。
- basestring超类已经去掉了,2to3工具会把每个出现的basestring替换成str。
- PEP3137:新类型bytes,用来表示二进制数据和编码文本,str和bytes不能混合,需要时,必须进行显示的转换,转换方法是str.encode()(str->bytes)和bytes.decode()(bytes->str).
- 在原始字符串(raw strings)中所有反斜线都按字面量解释,不再特殊处理Unicode转义字符。
- PEP3112:bytes字面量,例如b"abc",创建bytes实例。
- PEP3120:默认源文件编码为UTF-8
- PEP3131:可以使用非ASCII标识符(然而,除了注释中贡献者的名字之外,标准库仍然只包含ASCII)
- PEP3116:新的IO实现,API几乎100%向后兼容,二进制文件使用bytes代替strings
- 去除了StringIO和cStringIO模块,取而代之的是io.StringIO或者io.BytesIO
PEP3101:字符串格式化的新方法
- str.format方法(原文提到替代了%操作符,实际上,format方法和%的用法差别很大,各有所长)。
PEP3106:修补了dict的keys(),items(),values()方法
- 删除了dict.iterkeys(),dict.itervalues()和dict.iteritems()
- dict.keys(),dict.values()和dict.items()返回dict相关数据的引用
PEP3107:函数注解(Function Annotations)
Exception Stuff
- PEP352:异常类必须继承自BaseException,它异常结构的基类。
- 移除了StandardError
- Dropping sequence behavior (slicing!) and message attribute of exception instances.
- PEP3109:抛出异常:现在必须使用raise Exception(args)而不是原来的raise Exception, args
- PEP3110:捕获异常,现在必须使用except Exception as identifier而不是原来的except Exception, identifier
- PEP3134:异常链(Exception chain)。
- 改良了一些windows不能加载模式时的异常信息,具有本地化处理。
New Class and Metaclass Stuff
- 移除了classic class
- PEP3115:新的metaclass语法
- PEP3119:抽象基类。
- PEP3129:类包装。
- PEP3141:数字抽象基类
其他的语言变化
这里列出大多数的python语言核心和内建函数的变化。
- 移除了backticks(使用repr()代替)
- 移除了<>(不等号,使用!=代替)
- as和with变成了关键字
- True,False和None变成了关键字
- PEP237:long不存在了,只有int,它和原来的long一样。不再支持以L结尾的数字字面量。移除sys.maxint,因为int现在已经是无限大了
- PEP238:int相除,返回float
- 改变了顺序操作符的行为,例如x<y,当x和y类型不匹配时抛出TypeError而不是返回随即的bool值
- 移除了__getslice__,语法a[i:j]被解释成a.__getitem__(slice(i,j))
- PEP3102:keyword-only arguments.在函数参数列表中,出现在*args之后的命名参数只能使用"关键字参数"的形式调用
- PEP3104:nonlocal声明。使用nonlocal可以声明一个外部变量(不是global变量)
- PEP3111:raw_input()改名为input(),也就是说,新的input()函数从标准输入设备(sys.stdin)读取一行 并返回(不包括行结束符),如果输入过早终止,该函数抛出EOFError,如果想使用老的input(),可以使用eval(input())代替。
- xrange()改名为range(),range()现在不是产生一个列表(list),而是一个迭代器。
- PEP3113:移除了"元组参数拆包(tuple parameter unpacking)"。这种写法已经不行了:
def foo(a, (b, c)):...
现在要这样写:
def foo(a, b_c):
b,c = b_c
- PEP3114:next()重命名为__next__(),新的内建函数next()可以调用一个对象的__next__()方法。
- PEP3127:新的八进制字面量,二进制字面量和bin()函数。你应该写0o666而不是0666,oct()函数也做了响应的改动。同样,0b1010等价于10,bin(10)返回"0b1010"。0666这种写法现在是错误的。
- PEP3132:支持迭代器拆包。现在你可以这样写:
a, b, *rest = some_seqence
甚至象这样:
*rest, a = stuff
一般情况下,rest对象是list,而等号右边的对象是可迭代的 - PEP3135:新的super()。你可以不适用任何参数调用super(),正确的参数和实例会被正确选择。如果使用参数,它的行为不变,和以前一样。
- zip(),map(),filter()返回迭代器。
- 移除了string.letters和它的朋友们(string.lowcase和string.uppercase),现在上场的是string.ascii_letters等
- 移除了apply(),callable(),exefile(),file(),reduce(),reload()
- 移除了dict.has_key()。使用in操作符进行测试
- exec语句没有了,现在是exec()函数
- 移除了__oct__()和__hex__()特殊方法。oct()和hex()方法使用__index__()
- 移除了对__members__和__methods__的支持
- nb_nonzero重命名为nb_bool,__nonzero__()重命名为__bool__()
Optimizations
- 一般情况下,python 3.0比python 2.5慢33%左右。不过仍有提升空间。
模块变动(新的,改进的和废弃的)
- 移除了cPickle模块,可以使用pickle模块代替。最终我们将会有一个透明高效的模块。
- 移除了imageop模块
- 移除了audiodev, Bastion, bsddb185, exceptions, linuxaudiodev, md5, MimeWriter, mimify, popen2, rexec, sets, sha, stringold, strop, sunaudiodev, timing和xmllib模块
- 移除了bsddb模块(单独发布,可以从http://www.jcea.es/programacion/pybsddb.htm获取)
- 移除了new模块
- os.tmpnam()和os.tmpfile()函数被移动到tmpfile模块下
- tokenize模块现在使用bytes工作。主要的入口点不再是generate_tokens,而是tokenize.tokenize()
Build and C API Changes
Python’s build process和C API的改动包括:
- PEP3118:新的Buffer API
- PEP3121:扩展模块的的Initialization & Finalization
- PEP3123:使PyObject_HEAD符合标准C
原文地址: http://www.cnblogs.com/liangdx/archive/2007/03/02/661304.html
//资源:C:\Inetpub\AdminScripts\cscript adsutil.vbs ,C:\WINNT\system32\cscript.exe
adsutil.vbs HELP //获得帮助信息
cscript.exe adsutil.vbs //编译脚本
cscript adsutil.vbs ENUM w3svc/1/root //通过查看默认80站点信息来获取更多信息
//在默认站点下创建虚拟目录并指定工作文件夹和默认页面
C:\Inetpub\AdminScripts>adsutil.vbs create_vdir w3svc/1/root/789 //虚拟目录名称:789
created "w3svc/1/root/789"
C:\Inetpub\AdminScripts>adsutil.vbs set w3svc/1/root/789/path e:\html //虚拟目录磁盘路径
path : (STRING) "e:\html"
C:\Inetpub\AdminScripts>adsutil.vbs set w3svc/1/root/789/defaultdoc login.asp //虚拟目录起始页面
defaultdoc : (STRING) "login.asp"
//创建一个全新的web站点,指定端口,指定工作目录
C:\Documents and Settings\Administrator>cd C:\Inetpub\AdminScripts //启动命令行
C:\Inetpub\AdminScripts>adsutil.vbs enum /p w3svc //列出当前主机下所有站点信息,80站点为[/w3svc/1]
[/w3svc/Info]
[/w3svc/1]
[/w3svc/Filters]
[/w3svc/2]
[/w3svc/3]
[/w3svc/4]
[/w3svc/5]
[/w3svc/6]
[/w3svc/7]
[/w3svc/8]
[/w3svc/9]
[/w3svc/99]
C:\Inetpub\AdminScripts>adsutil.vbs delete w3svc/99 //删除99站点 ,99为主机站点索引,可任意,不可重复
deleted path "w3svc/99"
C:\Inetpub\AdminScripts>adsutil.vbs create_vserv w3svc/99 //创建99站点
created "w3svc/99"
C:\Inetpub\AdminScripts>adsutil.vbs set w3svc/99/serversize 1 //设置99站点大小
serversize : (INTEGER) 1
C:\Inetpub\AdminScripts>adsutil.vbs set w3svc/99/servercomment "my test websit" //设置99站点别名
servercomment : (STRING) "my test websit"
C:\Inetpub\AdminScripts>adsutil.vbs set w3svc/99/serverbindings ":10003:" //设置99站点端口
serverbindings : (LIST) ":10003:"
C:\Inetpub\AdminScripts>adsutil.vbs set w3svc/99/enabledefaultdoc true //设置99站点默认文档
enabledefaultdoc : (BOOLEAN) True
C:\Inetpub\AdminScripts>adsutil.vbs create_vdir w3svc/99/root //设置99站点下root虚拟目录,必须存在
created "w3svc/99/root"
C:\Inetpub\AdminScripts>adsutil.vbs set w3svc/99/root/path e:\html //设置99站点root工作目录
path : (STRING) "e:\html"
C:\Inetpub\AdminScripts>adsutil.vbs set w3svc/99/root/accessread true //设置99站点root可读
accessread : (BOOLEAN) True
C:\Inetpub\AdminScripts>adsutil.vbs set w3svc/99/root/accesswrite true //设置99站点root可写
accesswrite : (BOOLEAN) True
C:\Inetpub\AdminScripts>adsutil.vbs set w3svc/99/root/enabledirbrowsing true //设置99站点root可浏览
enabledirbrowsing : (BOOLEAN) True
C:\Inetpub\AdminScripts>adsutil.vbs set w3svc/99/root/enabledefaultdoc true //设置99站点root默认文档
enabledefaultdoc : (BOOLEAN) True
C:\Inetpub\AdminScripts>adsutil.vbs set w3svc/99/root/accessscript true //设置99站点root可执行脚本
accessscript : (BOOLEAN) True
C:\Inetpub\AdminScripts>adsutil.vbs set w3svc/99/root/appfriendlyName 默认应用程序 //设置99站点root应用程序属性
appfriendlyName : (STRING) "默认应用程序"
C:\Inetpub\AdminScripts>adsutil.vbs start_server w3svc/99 //启动99站点
Server w3svc/99 Successfully STARTED
2008年12月31日
1,离职
待更新。
2,新入职
待更新。
3,项目
4,项目管理
5,总结
1,好好学习一下英语了,毕业两年没说英语。
2,踏踏实实学习技术,打好基础,为以后更深入的发展做准备,不想当将军的士兵不是好士兵,关注asp.net+JavaScript+sqlserver,另外想了解一下网络基础的东西,tcp/ip协议等,做web开发一点都不懂总感觉不踏实。
3,软件开发方法,现在比较关注敏捷开发方法,感觉敏捷开发方法更适应国内中心企业的现状,况且现在的经济环境不太好,如何更快的交付可以使用的高质量软件无疑成为企业节流的新措施。
下午开年会,今天想写总结,突然事情特别多,哎~我的总结,我会回来重构你的。
2008年7月8日
刚开始用的时候到处上网找,把自己找到的东西记录下来,以备后用。
------查询所有数据库 系统库 用户库
select * from master.dbo.sysdatabases where dbid<7
select * from master.dbo.sysdatabases where dbid>=7
------查询一个数据库中的所有表 [type] = 'u' 是用户表,[type] = 's'是系统表
select * from dbname.dbo.[sysobjects] where [type] = 'u'
------查询一个表中的所有字段(我尝试不用[ID],而用[name]去查,结果报错了)
select * from dbname.dbo.[syscolumns] where id in (select id from dbname.dbo.[sysobjects] where name='empinfo')
------得到一个库的所有表 为当前用户具有权限的当前数据库中的每个表返回一行。
select * from INFORMATION_SCHEMA.TABLES
2008年6月12日
摘要: 下班了,先把代码贴上CodeCode highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/-->[TypeConverter(typeof(AddressConverter))]publicclassAddress{publicAddress(){}publicAddre...
阅读全文
2008年5月29日
摘要: 直接给出jsDebug.js的代码。CodeCode highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/-->1/**//*javascriptdebugger2*version1.0.0.03*authorzhaohuinet4*complete2008.05.285...
阅读全文
2008年5月6日
摘要: 最近项目要用到Dundas Chart组件了,做个小东西熟悉一下,做了一天了,图的效果不错。this is htmlcodeCodeCode highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/-->1<%@PageLanguage="C#"AutoEventWir...
阅读全文
2008年4月25日
摘要: 最近在看一些设计模式方面的东西,渐渐感觉到自己的基础很差,所以再回过头来学习一下基础的东西。简单的才是最容易接受的。1/**////<summary>2///抽象鸭子类3///msdn:abstract修饰符可以和类、方法、属性、索引器及事件一起使用。4///在类声明中使用abstract修饰符以指示某个类只能是其他类的基类。5///标记为抽象或包含在抽象类中的成员必须通过从抽象类派生...
阅读全文
2008年4月24日
摘要: 先来说说数组的不足(也可以说集合与数组的区别):(这是我看得别人的这段)1.数组是固定大小的,不能伸缩。虽然System.Array.Resize这个泛型方法可以重置数组大小,但是该方法是重新创建新设置大小的数组,用的是旧数组的元素初始化。随后以前的数组就废弃!而集合却是可变长的.2.数组要声明元素的类型,集合类的元素类型却是object.3.数组可读可写不能声明只读数组。集合类可以提供ReadO...
阅读全文