Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -------------------------------
- -----> Some Good Command <-----
- -------------------------------
- ----> System <----
- taskmgr, tasklist, qprocess, process, taskkill, tskill, print
- msconfig, sysedit, runas, net, assoc, Sc, powercfg, sfc, Sigverif, wmic
- bootcfg, bcedit
- sys, fixboot, fixmgr, bootsect
- (bootsect /nt52 -> XP\NT, bootsect /nt60 -> Vista & Seven | From Setup dvd --> command prompt bootsect /fixboot /fixmbr)
- takeown, cacls
- regedit, regedt32, reg
- shutdown, logoff
- Time, date
- ----> Network <----
- tracert, ping, ping6, netstat, telnet
- netsh, Ipconfig, getmac, Arp, hostname
- mountovol, subst, net, msg
- ----> CommandPrompt <----
- command, cmd
- exit, echo, type, Rem, pause, sleep
- set, Path
- call, goto, start
- Ftype, tskill, At, help, print
- Edit, edlin, type, Find, findstr
- mem, doskey, Shift, Mode, more
- sleep, timeout
- ----> Disk & File's <----
- chkdsk, chkntfs, defrag, scandisk\scandsk
- Format, Fdisk, convert, diskpart
- dir, tree, sort, diskcomp, comp, FC
- copy, Xcopy//32, diskcopy, Sys
- del, rd, Deltree, Erase
- Cd, MD, verify
- Ren, attrib
- Move, Replace
- Vol, Label
- ----> Cab <----
- expand, makecab
- ----> MSC & CPL <----
- In system32 directory there is some usefull things
- in ext CPL & MSC
- -----------------------
- -----> More crap <-----
- -----------------------
- :: \ rem ---> ignore this line's of batch
- cmd /c command & another command & & & & :P
- cmd /? if /? for /? set /?
- >nul (we disapere all comment's from process)
- set X=??? ---> %x%=???
- mode ??,??
- echo > ????- copy to file (make new file every time)
- echo >> ??? - copy to file (if exist file >>> add new line)
- cls, help, color, title, Prompt
- pause >??? (its pause ur script withput msg until u press enter)
- @ (for hide a line)
- @echo off \\\ @echo on (hide-show all script)
- echo.
- echo (and msg after it ... ^^)
- start (start app and continue after it ... ^^)
- "" (write all directory long name with ^^)
- sleep (wait a ??? sec)
- cd. cd.. cd\
- cd *folder*
- cd "" ---> for long name with space
- pushd \ popd \ cd \ exit \ exit /b (keep cmd windows's)
- mode X,y (example 40,2)
- ECHO ^>^& ---> >&
- echo \ command > ---- write 2 file (and delete the file if exist)
- echo \ command >> ---- write 2 file (keep the file and write)
- >nul 2>&1
- The first part, ">nul" means send standard output to the 'bit bucket" or in other words, throw it away.
- The second part, "2>&1" means "redirect standard error (2) to the same place as standard outout (1.)
- * 'reg>nul' see msg &&& 'reg>nul 2>&1' nothing tadam ***
- ** work with 0,1,2 +Also+ place can be replace'd
- set /p XXX=<file ---- Set 'first line of file' as %XXX%
- +++++++++++++++++++++++++++++++++++
- for %i in (string string string string string) do echo %i
- for %i in ("string" "string string" "string string string") do echo %i
- +++++++++++++++++++++++++++++++++++
- for /f "tokens=*" %i in ('command') do echo\set mypath=%i
- For /F "tokens=*" %I IN ('command ^| more command ^| ') DO CALL command %i
- for /f "tokens=*" %i in (file) do echo %i
- +++++++++++++++++++++++++++++++++++
- for /r | for /d
- - in batch file use %%i
- - "I" can be "X" too or Any letter From A -> 2 -> Z
- - "Tokens=x,y,z" --- x=i y=j z=k
- * "teokens=X,X,X,X" %%a .... will take 4 items in script in numrer u told him 'x=20 == place 20'
- and u can get this item's with %a %b %c %d 'each % mean another arg u told' '4X=%a-d' %e not exist
- bcz we didn't defind him .!
- - "tokens=1-3" \ "tokens=1,2,3" => %i,%j,%k
- - "tokens=1,2,*" => %i,%j,%k
- - "tokens=3*" => %i
- - "tokens=1,3,2,99,20" => %i,%j,%k, %l, %m
- * if no such thing 'token 99' SO Token 2 will return token(1)<X<token(99)
- |tokens=99999\*=abcde,nothing,nothing|
- * u can use 1 token if u want and J K will return nothing
- +++++++++++++++++++++++++++++++++++
- - "eol=xxx" ignore lines start with '=xxx'
- - "delims=xxx" replace value that split between item's with ur own value (instead of space " ")
- - "skip=X" skip X line's then start grab item's
- if not errorlevel 1 COMMAND ||| case of sucess
- if errorlevel 1 COMMAND ||| case of fail
- * it's not alaways work ....
- - & separates multiple commands on one command line.
- - && causes the command following this symbol to run if the command preceding the symbol +++ is successful +++
- ---> | <--- is swith 2 do command after command BUT *ON old data before*
- type ??? ---> we get data %XXX% | find "" ---> we find "" in %XXX% (we don't need to write find "" in file %xxx%, that the point of it :) got it ?)
- echo "listvolume" | diskpart ----> result will be "diskpart" on script file that contain our "listvo" before
- ---> & <--- is swith 2 do command after command BUT *old data is ignore*
- dir .... ---> we get %XXX% & del .... ---> on other data (not on %XXX%, only if write execaly del %xxx%)
- %XXX:~ [-]<0---9>\<0---9>(,<0---9>)%
- set xxx=1234567
- ---> %xxx:~3%=4567
- ---> %xxx:~3,2%=45
- ---> %xxx:~-3%=567
- ---> %xxx:~-3,2%=567
- "%0 %1 %2 ... %9" is return the Value of "xxx.cmd x1 x2 x3 ... x9"
- * ---> %* <--- will take all argu that u write .!
- * %~1,~* == %1,%*
- ..\xxx.cmd is argument %0 every argument that i add later will be %1 %2 %3
- like xxx.cmd test1 test2 > %1==test1 until 9.!
- instead of %X (x=0-9) u can use with <f,d,p,n,x,s,a,t,z, $PATH> & <0-9>
- an example %~dp0, %~tz8
- :xxx >> can be used for make a function that can be call'd BY call\goto :xxx
- call go to this and return back to original place
- goto go there and stay there
- another Big diff is that call :XXX %XyZ% will make all :xxx 2 use %xyz% as %1 :)
- while goto can't be used like this only "goto :xxx"
- |---> hmmmm one more thing <---|
- @echo off
- call :test x,y -OR- call :test x y -OR- :test "x" "y"
- :test
- echo '%1','%2'
- pause
- --> will return 'x','y'
- command | find "" or find /i ""
- z=0
- set /a z+=1 ---> z=1
- set /a z=%z%+1 ---> z=1
- if exist 'file\file's\folder\folder's' "command"
- if defined 'variable' "command"
- if "%xyz%"=="xyz" "command"
- - if \ if not
- - instead of |> "somthing"=="somthing" <| we can use this: EQU, NEQ, LSS, LEQ, GTR, GEQ
- if x=%x% if y=%y% if z=%z% set somthing=???
- if x=%x% (if y=%y% if z=%z% set somthing=???)
- * if defined \ exist \ errorlevel 'XYZ' +command+ -OR- (+command+)
- * if defined \ exist \ errorlevel 'XYZ' (+command+) else (+command+)
- * if defined \ exist \ errorlevel 'XYZ' (
- +command+
- ) else (
- +command+
- )
- :something
- if xyz call
- if xyz call
- if xyz call
- goto something
- :something
- if not xyz exit /b
- command
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement