Windows批处理手记


映射远程共享为本地磁盘

@echo off

cd \

net use \\192.168.194.252\ipc$ "admin" /user:kinwar

net use Y: \\192.168.194.252\SfisBackup

net use Z: \\192.168.194.252\Software


*************************************************************************************


资源管理器打开FTP

cd /c "C:\WINDOWS"

start explorer.exe "ftp://kinwar:admin@192.168.15.252"

IE浏览器器打开FTP

cd /c "C:\Program Files\Internet Explorer"

start iexplore.exe "ftp://kinwar:admin@Myftp.com.tw"


*************************************************************************************


同步某台PC的时间

title 同步某台PC的时间...

net use \\192.168.0.1\ipc$ "" /user:guest

net time \\192.168.0.1 /set /y

@pause


*************************************************************************************


获取当前日期和时间,分解

@echo off

cd\

echo 获取当前日期和时间,分解....

echo %date:~0,4%%date:~5,2%%date:~8,2%

echo %date:~0,4%

echo %date:~5,2%

echo %date:~8,2%


echo %time%

echo %time:~0,2%

echo %time:~3,2%

echo %time:~6,2%

pause


*************************************************************************************


增加路由

route add -p 192.168.192.0 mask 255.255.255.0 192.168.194.2

route add -p 192.168.193.0 mask 255.255.255.0 192.168.194.2


*************************************************************************************


共享的查看设置与删除

net share

net share Intel="f:\Intel"

net share Intel /del


*************************************************************************************



关闭网络连接

@echo off

regsvr32 /u netcfgx.dll

regsvr32 /u netshell.dll

regsvr32 /u netman.dll


*************************************************************************************

@echo 开始注册

copy w32time.dll %windir%\system32\

regsvr32 %windir%\system32\w32time.dll /s

@echo 注册成功

@pause


REM 循环注册所有system32下的dll

REM for %%i in (%windir%\system32\*.dll) do regsvr32.exe /s %%i


*************************************************************************************

REM 清理系统垃圾

@echo off

echo -.-

del /f /s /q %systemdrive%\*.tmp

del /f /s /q %systemdrive%\*._mp

del /f /s /q %systemdrive%\*.log

del /f /s /q %systemdrive%\*.gid

del /f /s /q %systemdrive%\*.chk

del /f /s /q %systemdrive%\*.old

del /f /s /q %systemdrive%\recycled\*.*

del /f /s /q %windir%\*.bak

del /f /s /q %windir%\prefetch\*.*

rd /s /q %windir%\temp & md %windir%\temp

del /f /q %userprofile%\cookies\*.*

del /f /q %userprofile%\recent\*.*

del /f /s /q "%userprofile%\Local Settings\Temporary Internet Files\*.*"

del /f /s /q "%userprofile%\Local Settings\Temp\*.*"

del /f /s /q "%userprofile%\recent\*.*"

echo

echo.

*************************************************************************************


@echo off

cd c:\mac

GetMACid.exe 8168FEF.CFG


REM Write MAC to EEPROM

PG8168 /EFUSE

if errorlevel 1 goto fail


goto pass

call c:\netset.bat

if %level%==1 goto netfail


REM check if this MAC ID has been used

rem if exist %back%\%macfile% goto usedid

if exist %local%\%macfile% goto usedid

if exist c:\log\*.* goto del

goto copy

:del

del c:\log\*.* /y

:copy

copy k:\*.log c:\log\. /y

find.exe /i "%macaddr%" c:\log\2008-07.log

if errorlevel 1 goto notexist

if errorlevel 0 goto usedid


:notexist

echo [log] >> c:\mac\%macfile%

echo productline=%productline% >> c:\mac\%macfile%

echo operatorname=%operatorname% >> c:\mac\%macfile%

echo lannum=1 >> c:\mac\%macfile%

rem  call program of writing MAC ID to EEPROM

xcopy c:\mac\%macfile% %local%:\

if errorlevel 1 goto cpyfail

goto pass


:satafail

fail.exe

echo Check SATA interface failed!

goto end

:cpyfail

echo copy INI file failed!

echo Press any key to goto fail!

pause

goto fail

:usedid

echo this MAC ID has been used!

echo Press any key to goto fail!

pause

goto fail

:netfail

echo connect to server fail!

echo Press any key to goto fail!

pause

goto fail

:fail

fail.exe

del c:\mac\%macfile%

echo      Write MAC address fail!

goto End

:pass

del c:\mac\%macfile%

pass.exe

echo      Write MAC address pass!

DELAY 1S

fdapm /pureoff

:end

*************************************************************************************



本文出自 “畅想天空” 博客,请务必保留此出处http://kinwar.blog.51cto.com/3723399/1357442

Windows批处理手记

上一篇:[转]Hibernate不能自动建表解决办法及Hibernate不同数据库的连接及SQL方言


下一篇:Android Intent的几种用法全面总结