More about CMD console start , delay and set proxy

1) start a process

a.exe                     //call a.exe and wait till a.exe finish running

start a.exe            //start a.exe then goto next line

start /min a.exe   //start a in minimum size and /max for maximum size

2) wait for certain duration

2.1) by ping somewhere:

        ping 1.1.1.1 -n 1 -w 4000    //wait for 4s

2.2)set time out

       timeout 180

3)wait for random duration

SET  /A mywait=  %RANDOM% * 100/32768 +15   
timeout %mywait%

4)start a process and wait for 5 s then kill it

start a.exe

timeout 5

taskkill /f /im a.exe

5) read lines in a text file

FOR /F "tokens=*" %%i IN (allText.txt) DO (
@echo %%i

)

6)launch internet iexplore.exe and open a url

iexplore.exe www.cclah.com

7)launch internet iexplore.exe without any plugin

iexplore.exe –extoff

8)set proxy

netsh winhttp set proxy 62.165.42.170:8080   //one will receive error 5: access is denied

9)run a program as administrator and then set proxy

runas.exe /savecred /user:administrator "netsh winhttp set proxy 62.165.42.170:8080"

10)check  proxy

netsh winhttp show proxy

11)reset proxy

runas.exe /savecred /user:administrator "netsh winhttp reset proxy"

12)list all running task

tasklist/v

13)loop forever

12.1)within a.bat call a.bat

12.2):loopName

          do something here

          goto :loopName

 

 

 

Ref:

http://stackoverflow.com/questions/8249705/how-to-run-an-app-as-run-as-administrator-from-command-prompt

http://technet.microsoft.com/en-us/library/cc947813(v=ws.10).aspx

http://mgombar.wordpress.com/2012/03/07/windows-8-and-proxy-servers/

http://superuser.com/questions/419696/in-windows-7-how-to-change-proxy-settings-from-command-line

Now moving to www.cclah.com

About these ads

发表评论

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / 更改 )

Twitter picture

You are commenting using your Twitter account. Log Out / 更改 )

Facebook photo

You are commenting using your Facebook account. Log Out / 更改 )

Google+ photo

You are commenting using your Google+ account. Log Out / 更改 )

Connecting to %s

关注

每发布一篇新博文的同时向您的邮箱发送备份。

%d 博主赞过: