ZT: 远程桌面被自动断开的解决方法

自己一台VM碰到这样的问题,Google千百度,总算找到一解决方案,记下备查。如下:

远程桌面被自动断开的解决方法

自上学期开始,这个问题一直困扰着我。在机房上课的时候,总要远程控制自己宿舍的电脑,干点不正经的事…
悲剧的是每次连上没几分钟就会自动断开,提示是有另外一个用户强制登陆把我给T下来了。我有设密码,所以比可能被其他人T的,而且无论在哪里,用哪台机子都出现这样的情况!
因为我经常通过远程写代码的,所以这种不爽应该能够体会得到,早上4节课下来没重连个50次是不可能的。
上网找了很多Google,都没有遇见这种情况的!
后来我受不了了,装了个64位的WIN7。用WIN7优化大师简单配置一下,到学校机房,还是一样?!老是自动断开。
突然我想到了可能是我设置自动登录的问题!对于新装的系统,我只是简单配置了一下,开机时自动登录,并且注销后也会自动登录。这么一想就想通了
打开WIN7优化大师,还是让他自动登录,只不过取消了注销后自动登录,就行了…
再加上自己查的

Win7小技巧:用户账户自动登录方法汇总 – Windows7之家,Win7之家
http://www.win7china.com/html/16358.html

清明诗三首

清明不见雨纷纷
路上行人亦断魂
已恨陵园郊外远
又逢车马阻前程

一日清明几处哀
合家老幼奔陵台
纸钱供果虽丰盛
还望黄泉寄语来

(代母书)
衣物犹存未忍翻
心伤往事泪无干
毕生辛苦老来伴
化作遗容入梦难

2008-4-20 13:50:29

小学生造句

1.题目:一边……一边……
小朋友写:他一边脱衣服,一边穿裤子。
老师批语:他到底是要脱还是要穿啊?

2.题目:其中
小朋友写:我其中的一只左脚受伤了。
老师批语:你是蜈蚣吗?

3.题目:陆陆续续
小朋友写:下班了,爸爸陆陆续续的回家了。
老师批语:你到底有几个爸爸呀?

4.题目:难过
小朋友写:我家门前有条水沟很难过。
老师批语:老师更难过。

5.题目:又……又……
小朋友写:我的妈妈又矮又高又胖又瘦。
老师批语:你的妈妈是变形金刚吗?

6.题目:你看
小朋友写:你看什么看!没看过啊?
老师批语:没看过……

7.题目:欣欣向荣
小朋友写:欣欣向荣荣告白。
老师批语:连续剧不要看太多了!

8.题目:好吃
小朋友写:好吃个屁。
老师批语:有些东西是不能吃的。

9.题目:天真
小朋友写:今天真热。
老师批语:你真天真。

10.题目:果然
小朋友写:昨天我吃水果,然后喝凉水。
老师批语:是词组,不能分开的。

11.题目:先……再……,例题:先吃饭,再洗澡。
小朋友写:先生,再见!
老师批语:想象力超过了地球人的智慧。

12.题目:况且
小朋友写:一列火车经过,况且况且况且况且况且况。
老师批语:我死了算了。

ZT: Top 10 DOS Batch tips (Yes, DOS Batch…)

转自:http://weblogs.asp.net/jgalloway/archive/2006/11/20/top-10-dos-batch-tips-yes-dos-batch.aspx

PowerShell’s great. I’m fired up about the opportunity to use .NET objects from simple scripts. I’ll admit I’m still getting up to speed with it, but I’m totally sold on PowerShell.

However, it’s not installed on a lot of servers I work with, and I still do a lot of my “clumsy developer attempting DBA and network admin” tasks from DOS Batch files. You can do quite a bit with DOS Batch – the silly fact is the my most popular posts (by a huge margin) are some batch scripts to allow running IE7 and IE6 on the same computer.

So, by way of tribute to the dying art of the DOS Batch file, I present my top ten batch file tricks:

  1. Use PUSHD / POPD to change directories
    Read Scott Hanselman’s writeup on PUSHD. The basic idea is that it keeps a stack, so at the simplest level you can do something like this:

    PUSHD “C:\Working Directory\” ::DO SOME WORK POPD

    That allows you to call the batch file from any directory and return to the original directory when you’re done. The cool thing is that PUSHD can be nested, so you can move all over the place within your scripts and just POPD your way out when you’re done.

  2. Call FTP scripts
    This sample prompts for the username and password, but they can of course be hardcoded if you’re feeling lucky.

    set FTPADDRESS=ftp.myserver.com set SITEBACKUPFILE=FileToTransfer.zip set /p FTPUSERNAME=Enter FTP User Name: set /p FTPPASSWORD=Enter FTP Password: CLS > script.ftp USER >>script.ftp ECHO %FTPUSERNAME% >>script.ftp ECHO %FTPPASSWORD% >>script.ftp ECHO binary >>script.ftp ECHO prompt n :: Use put instead of get to upload the file >>script.ftp ECHO get %SITEBACKUPFILE% >>script.ftp ECHO bye FTP -v -s:script.ftp %FTPADDRESS% TYPE NUL >script.ftp DEL script.ftp
  3. Read from the registry
    You can make creative use of the FOR command to read from and parse a registry value (see my previous post for more info).

    FOR /F “tokens=2* delims= ” %%A IN (‘REG QUERY “HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SQL Server\Instance Names\SQL” /v SQL2005’) DO SET SQLINSTANCE=%%B
  4. Run SQL Commands
    You can call OSQL (or SQLCMD on servers with SQL 2005 installed) to execute SQL commands:

    osql -E -d master -Q “BACKUP DATABASE [%DATABASENAME%] TO DISK = N’D:\DataBase\Backups\%DATABASENAME%_backup’ WITH INIT , NOUNLOAD , NAME = N’%DATABASENAME% backup’, NOSKIP , STATS = 10, NOFORMAT”
  5. Check if a file or folder exists
    I used this to do a quick and dirty check to see if a Windows Hotfix had been installed in my IE7 Standalone scripts:

    IF EXIST %SystemRoot%\$NtUninstallKB915865$\ GOTO KB_INSTALLED ECHO Installing Hotfix (KB915865) to allow tab support START /D “%~dp0/Installation/Update/” xmllitesetup.exe
  6. Pause execution for a number of seconds
    There are different ways to do this from within a batch file, all with their tradeoffs. I use a ping to an invalid IP address with a timeout. The best way to do this is to find an invalid IP address and then pint it, but 1.1.1.1 is a pretty safe bet:

    ECHO Waiting 15 seconds PING 1.1.1.1 -n 1 -w 15000 > NUL
  7. Use defaults for optional parameters
    It’s not really easy to check for a missing parameter. You have to use something like “IF dummy==%1dummy”, which will only be true if %1 is empty. So, for example, here we’re allowing a user to supply an application path via the third parameter, and defaulting it if it’s missing. By the way, beware the IF syntax. The line spacing makes a difference, so this is one that I just copy and paste to avoid figuring it out every time.

    IF dummy==dummy%3 ( SET APPLICATIONPATH=”C:\Program Files\MyApp\” ) ELSE ( SET APPLICATIONPATH = %3 )
  8. Process each file matching a pattern in a directory
    I previously posted a script which iterates all files named *.bak in a directory and restores them on the local instance of SQL Server. Here’s an excerpt:

    PUSHD %BACKUPDIRECTORY% FOR %%A in (*.bak) do CALL :Subroutine %%A POPD GOTO:EOF :Subroutine set DBNAME=%~n1 ::RUN SOME OSQL COMMANDS TO RESTORE THE BACKUP GOTO:EOF
  9. Use batch parameter expansion to avoid parsing file or directory info
    Batch file parameters are read as %1, %2, etc. DOS Command Extensions – available on Windows 2000 and up – add a lot of automatic parsing and expansion that really simplifies reading filenames passed in as parameters. I originally put this at the top of the list, but I moved it because I figured the insane syntax would drive people off. I wrote a simple batch script that shows some examples. I think that makes it a little more readable. Stick with me, I think this is one of the best features in DOS batch and is worth learning.

    First, here’s the batch file which just echos the processed parameters:

    @echo off echo %%~1 = %~1 echo %%~f1 = %~f1 echo %%~d1 = %~d1 echo %%~p1 = %~p1 echo %%~n1 = %~n1 echo %%~x1 = %~x1 echo %%~s1 = %~s1 echo %%~a1 = %~a1 echo %%~t1 = %~t1 echo %%~z1 = %~z1 echo %%~$PATHATH:1 = %~$PATHATH:1 echo %%~dp1 = %~dp1 echo %%~nx1 = %~nx1 echo %%~dp$PATH:1 = %~dp$PATH:1 echo %%~ftza1 = %~ftza1

    Now we’ll call it, passing in “C:\Windows\Notepad.exe” as a parameter:

    C:\Temp>batchparams.bat c:\windows\notepad.exe %~1 = c:\windows\notepad.exe %~f1 = c:\WINDOWS\NOTEPAD.EXE %~d1 = c: %~p1 = \WINDOWS\ %~n1 = NOTEPAD %~x1 = .EXE %~s1 = c:\WINDOWS\NOTEPAD.EXE %~a1 = –a—— %~t1 = 08/25/2005 01:50 AM %~z1 = 17920 %~$PATHATH:1 = %~dp1 = c:\WINDOWS\ %~nx1 = NOTEPAD.EXE %~dp$PATH:1 = c:\WINDOWS\ %~ftza1 = –a—— 08/25/2005 01:50 AM 17920 c:\WINDOWS\NOTEPAD.EXE

    As I said, the syntax is completely crazy, but it’s easy to look them up – just type HELP CALL at a DOS prompt; it gives you this:

    %~1 – expands %1 removing any surrounding quotes (“)
    %~f1 – expands %1 to a fully qualified path name
    %~d1 – expands %1 to a drive letter only
    %~p1 – expands %1 to a path only
    %~n1 – expands %1 to a file name only
    %~x1 – expands %1 to a file extension only
    %~s1 – expanded path contains short names only
    %~a1 – expands %1 to file attributes
    %~t1 – expands %1 to date/time of file
    %~z1 – expands %1 to size of file
    %~$PATH:1 – searches the directories listed in the PATH environment variable and expands %1 to the fully qualified name of the first one found. If the environment variable name is not defined or the file is not found by the search, then this modifier expands to the empty string
    The modifiers can be combined to get compound results:

    %~dp1 – expands %1 to a drive letter and path only
    %~nx1 – expands %1 to a file name and extension only
    %~dp$PATH:1 – searches the directories listed in the PATH environment variable for %1 and expands to the drive letter and path of the first one found.
    %~ftza1 – expands %1 to a DIR like output line

    In the above examples %1 and PATH can be replaced by other valid values. The %~ syntax is terminated by a valid argument number. The %~ modifiers may not be used with %*

  10. Learn from the masters
    By far, my favorite resource for DOS Batch trickery is the Batch Files section of Rob van der Woude’s Scripting Pages. He’s got some good PowerShell resources, too.

老友重聚

一大学老友因差至京,小聚。

开篇·喝酒

水煮牛蛙热气腾
二锅头里感情深
笑谈常引当年事
感慨不离故旧情

中场·打电话

金陵别后久无闻
各散东西十四春
今日千里传音至
几人犹能辨阿旻

剧终·结语

意气风发聚港航
朝夕共处乐四方
一生好景君须记
最是同学少年郎

于2008-10-31 23:09:45

几个笑话

1、一饿狼觅食,听到有女人在训孩子:再哭就把你扔出去喂狼!孩子哭一夜,狼在门外痴痴等至天亮,长叹一声:骗子,女人都是骗子!
2.一犯人被执行枪决 ,由于子弹是劣质的,第一枪没放出,接着又放了第二枪…第三枪…这时犯人哭了:大哥你掐死我吧,太他妈吓人了!
3.一老太太看完黑人百米赛后,抹着眼泪说:吓死人!几个挖煤的跪成一排被枪毙,没瞄准就开了枪,娃儿们吓得那个跑呀,绳子都拦不住哇!
4、黄先生热爱革命,为纪念红军,给儿子取名为’军’, 一天送儿子上课,见公交 8路进站, 于是冲儿子大喊:黄军快跑,八路来了!~~~
5、一只小熊去山里创业,农夫给了他一把镰刀,木匠给了他一把锤子, 小熊来到山里遇到老虎,吓得把镰刀、锤子举在头顶,老虎说:没看出来,就你这熊样还是个党员来!
6、农夫挑担大粪,老外看到后问:大爷,这酱多少钱一斤? 农夫不语,老外用手沾了点放进嘴里,心想:你不告诉我多少钱一斤,我也不告诉你你的酱都臭了。