程式設計師用dos只需要輸入一個命令,開始一天工作?

echo ===========================================================

echo 從這裡開啟程式入口:2011年8月26日

echo 1pm self auto tool echo type help for help;q for exit

echo #1 1pmtc u盤本地化,避免反覆的讀寫u盤 /ulocal

echo or

echo 1pm 直接在u盤操作 /u

echo #2 p 載入分割槽 /desk/pc/self

echo ######good luck!######

echo ====================================

win 下用dos管理自己的工作入口

背景:本是從事編碼工作,有的時候需要開啟的軟體較多,就想寫以個可以通過命令開啟需要的軟體的dos

實現功能:

1)通過輸入自定義的命令批量開啟 工作必須軟體

2)載入加密分割槽

3)正在清理系統垃圾檔案

詳細功能如下

echo help -- get help information

echo desk -- 開啟桌面資料夾

echo pc -- 開啟我的電腦

echo host -- edit win host files

echo gvim -- open gvim edit tool

echo delshare -- del default share volume

echo 1pm -- open 1pmEn folder in U disk

echo 1pmtc -- open 載入虛擬分割槽

echo u -- open U盤

echo ulocal -- open U盤的本地硬碟映象

echo self -- open run1pm's self floder

echo client -- open runlpm client is client to 1pm

echo q -- exit this

echo cmd -- get cmd path here

echo cls --

echo dir --

echo kill -- kill all the same process by processname

echo dtemp -- del temp file

echo +app{

echo dw -- open dreawear

echo ea -- open EA

echo ep -- open Eidtplus3

echo eve -- open everthing

echo ec -- open eclipse for php

echo ff -- open firefox

echo ftp -- open filezilla.exe ftp_client

echo jsq -- open 計算器

echo op -- open opera brower

echo pd -- open pd15.3

echo ps -- open powershell

echo qq -- open qq

echo mysql -- open mysql client

echo mssql -- open mssql client

echo npm -- open NPMserv.exe

echo vbox -- open virturl machine

echo vmp -- open virturl machine

echo vm -- open virturl machine

echo word -- open office word

echo wz -- open wz

echo diff -- open WinMerge

echo }

echo +cmd{

echo mv -- copy path filename

echo }

rem goto input

echo.

echo work -- begin work with open softs !

echo ...

可以自行載入 命令和方法

1) mingling

2)

:getmingling{

start H:\U-Disk\app\1pmEn\

goto winput

}

工具/原料

dos

bat

方法/步驟

全部原始碼:

```dos

@echo off

rem ======================================================

rem run info

rem ======================================================

rem get var

rem set /p varvolume=請輸入volum

rem help

:echoinfo

(

echo ===========================================================

echo 從這裡開啟程式入口:2011年8月26日

echo 1pm self auto tool echo type help for help;q for exit

echo #1 1pmtc u盤本地化,避免反覆的讀寫u盤 /ulocal

echo or

echo 1pm 直接在u盤操作 /u

echo #2 p 載入分割槽 /desk/pc/self

echo ######good luck!######

echo ==========================================================

)

rem 標記退出

set flag=0

rem app路徑

set appsoftDir="D:\appSoft"

set greensoftDir="D:\greenSoft"

rem >>後面不能使用變數 (?)

rem 下面的會到處生成日誌

rem set curDir=%%~dp0%run1pm.log

set curDir="%USERPROFILE%\Desktop\1pmEn\run1pm.log"

:winput

set /p var=Input:

rem (

rem call echo # %date:~0,4%%date:~5,2%%date:~8,2% %time% %%var%% >>a.log

rem 下面的行不通

rem call echo # %date:~0,4%%date:~5,2%%date:~8,2% %time% %%var%% >>%curDir%

rem call echo %%var%%

rem )>>call %curDir%

rem 必須用全域性的變數

call echo # %date:~0,4%%date:~5,2%%date:~8,2% %time% %%var%% >>"%USERPROFILE%\Desktop\1pmEn\run1pm.log"

rem ======================================================

rem 命令

REM :STR_VISTOR

REM 看看每次迴圈後的值,便於理解

REM echo str = %str%

REM FOR語句是按行進行遍歷,也就是一行一次迴圈,對於我們來說,只有一行字串,

REM 這個FOR迴圈肯定只進入一次。而我們是要對字串進行空格分割後再處理。因此這

REM 裡用GOTO語句來實現迴圈。而FOR語句只需看成是一條語句,這條語句實現了這樣的

REM 功能:將字串分割成兩一部分,一部分是第一個空格前的字串,另一部分是剩餘的

REM 字串(tokens=1,*)。第一部分儲存在 a 變數中,第二部分儲存在 b 變數中,這

REM 個 b 是自動的。

REM 類似gloabl php

setlocal enabledelayedexpansion

set doscmds=null

set tempcmd="%var%"

for /f "tokens=1,*" %%a in (%tempcmd%) do (

REM 這裡可以替換成自己的處理程式,現在只是簡單地顯示值

REM echo a = %%a

set doscmds=%%a

REM 將剩餘字串賦值給str變數

set tempcmd="%%b"

REM echo b=%%b

REM goto STR_VISTOR

)

if not %tempcmd%=="" (

if "%doscmds%"=="mv" goto cmdmv

rem 修改名

if "%doscmds%"=="mvname" goto cmdmvname

)

rem ======================================================

rem ifdaf

if "%var%"=="q" goto exitthis

if "%var%"=="help" goto gethelp

set golabel=get%var%

if 1==1 goto %golabel%

goto exitthis

rem ====================================

rem goto block

rem ====================================

:getdelshare

(

net share c$ /del

net share d$ /del

net share e$ /del

net share f$ /del

net share admin$ /del

net stop server

goto winput

)

:getgvim

(

start %greensoftDir%\vim73\gvim.exe

goto winput

)

:getcmd

(

start cmd.exe

goto winput

)

:gethost

(

start %greensoftDir%\vim73\gvim.exe c:\WINDOWS\system32\drivers\etc\hosts

goto winput

)

:getkill

rem 如果用括號括起來,在一對()裡面,這就叫“複合語句” 會出現變數延遲的情況。

set /p pidvar=要結束的程序名或PID:

taskkill /f /im %pidvar% taskkill /f /pid %pidvar%

pause

goto winput

:getdtemp

echo 正在清理系統垃圾檔案,請稍等......

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 清理系統垃圾完成!

pause

goto winput

rem --------------------------------------------------

rem --------------------------------------------------

rem appsoft here

rem %greensoftDir%\NPMserv\NPMserv.exe

:getnpm

(

cd %greensoftDir%\NPMserv

D:

start NPMserv.exe

goto winput

)

rem app

:getdw

(

start "" "%greensoftDir%\Dreamweaver 8\Dreamweaver.exe"

goto winput

)

:getea

(

start %appsoftDir%\EA\EA.exe

goto winput

)

:getep

(

start "" "C:\Program Files\EditPlus 3\EditPlus.exe"

goto winput

)

:geteve

(

start "" "C:\Program Files\Everything\Everything.exe"

goto winput

)

:getec

(

start %appsoftDir%\EasyEclipsePHP\eclipse.exe

goto winput

)

:getff

(

start "" "C:\Program Files\Mozilla Firefox\firefox.exe"

goto winput

)

:getjsq

(

start %SystemRoot%\system32\calc.exe

goto winput

)

:getop

(

start "" "C:\Program Files\Opera\opera.exe"

goto winput

)

:getpd

(

start %appsoftDir%\pd153\pdshell15.exe

goto winput

)

:getps

(

start %SystemRoot%\system32\WindowsPowerShell\v1.0\powershell_ise.exe

goto winput

)

:getqq

(

start %appsoftDir%\qq2011\Bin\QQ.exe

goto winput

)

:getmysql

(

start "" "C:\Documents and Settings\Administrator\Desktop\1pmEn\workBegin\Navicat_for_MySQL9\navicat.exe"

goto winput

)

:getmssql

(

start SQLServerManager10.msc

start Ssms.exe

goto winput

)

:getvbox

(

start "" "%greensoftDir%\Virtualbox\VirtualBox.exe"

goto winput

)

:getvmp

(

start "" "%appsoftDir%\VM7\vmplayer.exe"

goto winput

)

:getvm

(

start %appsoftDir%\VM7\vmware.exe

goto winput

)

:getword

(

rem 空格帶引號的 必須前有有空雙引號,如果沒有空格可直接start 或直接寫路徑,

start "" "C:\Program Files\Microsoft Office\OFFICE11\WINWORD.EXE"

goto winput

)

:getwz

(

rem wiz

start "" "%appsoftDir%\Wiz\WizExplorer.exe"

goto winput

)

:getwork

(

start "" "%greensoftDir%\!)work.bat"

goto winput

)

:getclient

(

start "" "%USERPROFILE%\Desktop\1pmEn\"

goto winput

)

:getself

(

rem 當前路徑

rem call echo cur:%%~dp0%

rem echo "%%~dp0%"

start "" "%~dp0"

pause

goto winput

)

:getdesk

(

start "" "%USERPROFILE%\Desktop"

goto winput

)

:getpc

(

start shell:DriveFolder

goto winput

)

:getdiff

(

start "" "C:\Program Files\WinMerge\WinMergeU.exe"

goto winput

)

:getftp

(

start "" "%greensoftDir%\FileZilla-3.5.3\filezilla.exe"

goto winput

)

rem ---------------------------------------------------

rem ---------------------------------------------------

rem ---------------------------------------------------

rem ---------------------------------------------------

rem ---------------------------------------------------

rem ---------------------------------------------------

rem ---------------------------------------------------

rem ---------------------------------------------------

rem ---------------------------------------------------

rem ---------------------------------------------------

rem ---------------------------------------------------

rem ---------------------------------------------------

rem ---------------------------------------------------

rem ---------------------------------------------------

rem ---------------------------------------------------

rem ---------------------------------------------------

rem ---------------------------------------------------

rem ---------------------------------------------------

:gethelp

(

echo help -- get help information

echo desk -- 開啟桌面資料夾

echo pc -- 開啟我的電腦

echo host -- edit win host files

echo gvim -- open gvim edit tool

echo delshare -- del default share volume

echo 1pm -- open 1pmEn folder in U disk

echo 1pmtc -- open 載入虛擬分割槽

echo u -- open U盤

echo ulocal -- open U盤的本地硬碟映象

echo self -- open run1pm's self floder

echo client -- open runlpm client is client to 1pm

echo q -- exit this

echo cmd -- get cmd path here

echo cls --

echo dir --

echo kill -- kill all the same process by processname

echo dtemp -- del temp file

echo +app{

echo dw -- open dreawear

echo ea -- open EA

echo ep -- open Eidtplus3

echo eve -- open everthing

echo ec -- open eclipse for php

echo ff -- open firefox

echo ftp -- open filezilla.exe ftp_client

echo jsq -- open 計算器

echo op -- open opera brower

echo pd -- open pd15.3

echo ps -- open powershell

echo qq -- open qq

echo mysql -- open mysql client

echo mssql -- open mssql client

echo npm -- open NPMserv.exe

echo vbox -- open virturl machine

echo vmp -- open virturl machine

echo vm -- open virturl machine

echo word -- open office word

echo wz -- open wz

echo diff -- open WinMerge

echo }

echo +cmd{

echo mv -- copy path filename

echo }

rem goto input

echo.

echo work -- begin work with open softs !

echo ...

goto winput

)

:getcls

(

cls

goto echoinfo

)

:getdir

(

dir

goto winput

)

rem ========================================

rem ========================================

rem ========================================

:get1pmtc

(

start "" "%greensoftDir%\crypt_7z\"

goto winput

)

:get1pm

(

start %appsoftDir%\app\1pmEn\

goto winput

)

:getulocal

(

start W:\upan\

goto winput

)

:getu

(

start H:\U-Disk\

goto winput

)

rem ========================================

rem ========================================

rem ========================================

rem exit

rem ========================================

:get

(

goto winput

)

:exitthis

(

exit

)

rem 監視不存在的 label

goto winput

rem =======================================================

rem ====cmd dos

rem =======================================================

:cmdmv

(

rem %tempcmd:~0,-1% 去打最後的“和開始的”

copy %tempcmd:~1,-1%

pause

goto winput

)

rem =======================================================

@echo on

rem mv:move or rename

rem (copy xcopy) cp

rem del (rm)

rem rmdir

rem mkdir

rem

rem RD [/S] [/Q] [drive:]path

rem /S 除目錄本身外,還將刪除指定目錄下的所有子目錄和檔案。用於刪除目錄樹。

rem /Q 安靜模式,帶 /S 刪除目錄樹時不要求確認

rem

rem

rem ---linux

rem mkdir目錄名建立一個目錄

rem rmdir空目錄名刪除一個空目錄

rem

rem

rem rm檔名檔名刪除一個檔案或多個檔案

rem rm -rf非空目錄名刪除一個非空目錄下的一切

```

程式設計師用dos只需要輸入一個命令,開始一天工作

程式設計師用dos只需要輸入一個命令,開始一天工作

注意事項

1)請修改為自己的應用路徑

2)可以擴充套件自己的dos命令

相關問題答案