Advertisement
Guest User

maorosh

a guest
Oct 20th, 2009
184
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.32 KB | None | 0 0
  1.  
  2. -------------------------------
  3. -----> Some Good Command <-----
  4. -------------------------------
  5.  
  6. ----> System <----
  7.  
  8. taskmgr, tasklist, qprocess, process, taskkill, tskill, print
  9. msconfig, sysedit, runas, net, assoc, Sc, powercfg, sfc, Sigverif, wmic
  10. bootcfg, bcedit
  11. sys, fixboot, fixmgr, bootsect
  12. (bootsect /nt52 -> XP\NT, bootsect /nt60 -> Vista & Seven | From Setup dvd --> command prompt bootsect /fixboot /fixmbr)
  13. takeown, cacls
  14. regedit, regedt32, reg
  15. shutdown, logoff
  16. Time, date
  17.  
  18. ----> Network <----
  19.  
  20. tracert, ping, ping6, netstat, telnet
  21. netsh, Ipconfig, getmac, Arp, hostname
  22. mountovol, subst, net, msg
  23.  
  24. ----> CommandPrompt <----
  25.  
  26. command, cmd
  27. exit, echo, type, Rem, pause, sleep
  28. set, Path
  29. call, goto, start
  30. Ftype, tskill, At, help, print
  31. Edit, edlin, type, Find, findstr
  32. mem, doskey, Shift, Mode, more
  33. sleep, timeout
  34.  
  35. ----> Disk & File's <----
  36.  
  37. chkdsk, chkntfs, defrag, scandisk\scandsk
  38. Format, Fdisk, convert, diskpart
  39. dir, tree, sort, diskcomp, comp, FC
  40. copy, Xcopy//32, diskcopy, Sys
  41. del, rd, Deltree, Erase
  42. Cd, MD, verify
  43. Ren, attrib
  44. Move, Replace
  45. Vol, Label
  46.  
  47. ----> Cab <----
  48.  
  49. expand, makecab
  50.  
  51. ----> MSC & CPL <----
  52.  
  53. In system32 directory there is some usefull things
  54. in ext CPL & MSC
  55.  
  56. -----------------------
  57. -----> More crap <-----
  58. -----------------------
  59.  
  60. :: \ rem ---> ignore this line's of batch
  61. cmd /c command & another command & & & & :P
  62. cmd /? if /? for /? set /?
  63. >nul (we disapere all comment's from process)
  64. set X=??? ---> %x%=???
  65. mode ??,??
  66. echo > ????- copy to file (make new file every time)
  67. echo >> ??? - copy to file (if exist file >>> add new line)
  68. cls, help, color, title, Prompt
  69. pause >??? (its pause ur script withput msg until u press enter)
  70. @ (for hide a line)
  71. @echo off \\\ @echo on (hide-show all script)
  72. echo.
  73. echo (and msg after it ... ^^)
  74. start (start app and continue after it ... ^^)
  75. "" (write all directory long name with ^^)
  76. sleep (wait a ??? sec)
  77. cd. cd.. cd\
  78. cd *folder*
  79. cd "" ---> for long name with space
  80. pushd \ popd \ cd \ exit \ exit /b (keep cmd windows's)
  81. mode X,y (example 40,2)
  82. ECHO ^>^& ---> >&
  83.  
  84. echo \ command > ---- write 2 file (and delete the file if exist)
  85. echo \ command >> ---- write 2 file (keep the file and write)
  86.  
  87. >nul 2>&1
  88. The first part, ">nul" means send standard output to the 'bit bucket" or in other words, throw it away.
  89. The second part, "2>&1" means "redirect standard error (2) to the same place as standard outout (1.)
  90. * 'reg>nul' see msg &&& 'reg>nul 2>&1' nothing tadam ***
  91. ** work with 0,1,2 +Also+ place can be replace'd
  92.  
  93. set /p XXX=<file ---- Set 'first line of file' as %XXX%
  94. +++++++++++++++++++++++++++++++++++
  95. for %i in (string string string string string) do echo %i
  96. for %i in ("string" "string string" "string string string") do echo %i
  97. +++++++++++++++++++++++++++++++++++
  98. for /f "tokens=*" %i in ('command') do echo\set mypath=%i
  99. For /F "tokens=*" %I IN ('command ^| more command ^| ') DO CALL command %i
  100. for /f "tokens=*" %i in (file) do echo %i
  101. +++++++++++++++++++++++++++++++++++
  102. for /r | for /d
  103. - in batch file use %%i
  104. - "I" can be "X" too or Any letter From A -> 2 -> Z
  105. - "Tokens=x,y,z" --- x=i y=j z=k
  106. * "teokens=X,X,X,X" %%a .... will take 4 items in script in numrer u told him 'x=20 == place 20'
  107. and u can get this item's with %a %b %c %d 'each % mean another arg u told' '4X=%a-d' %e not exist
  108. bcz we didn't defind him .!
  109. - "tokens=1-3" \ "tokens=1,2,3" => %i,%j,%k
  110. - "tokens=1,2,*" => %i,%j,%k
  111. - "tokens=3*" => %i
  112. - "tokens=1,3,2,99,20" => %i,%j,%k, %l, %m
  113. * if no such thing 'token 99' SO Token 2 will return token(1)<X<token(99)
  114. |tokens=99999\*=abcde,nothing,nothing|
  115. * u can use 1 token if u want and J K will return nothing
  116. +++++++++++++++++++++++++++++++++++
  117. - "eol=xxx" ignore lines start with '=xxx'
  118. - "delims=xxx" replace value that split between item's with ur own value (instead of space " ")
  119. - "skip=X" skip X line's then start grab item's
  120.  
  121. if not errorlevel 1 COMMAND ||| case of sucess
  122. if errorlevel 1 COMMAND ||| case of fail
  123. * it's not alaways work ....
  124.  
  125. - & separates multiple commands on one command line.
  126. - && causes the command following this symbol to run if the command preceding the symbol +++ is successful +++
  127.  
  128. ---> | <--- is swith 2 do command after command BUT *ON old data before*
  129. 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 ?)
  130. echo "listvolume" | diskpart ----> result will be "diskpart" on script file that contain our "listvo" before
  131.  
  132. ---> & <--- is swith 2 do command after command BUT *old data is ignore*
  133. dir .... ---> we get %XXX% & del .... ---> on other data (not on %XXX%, only if write execaly del %xxx%)
  134.  
  135. %XXX:~ [-]<0---9>\<0---9>(,<0---9>)%
  136. set xxx=1234567
  137. ---> %xxx:~3%=4567
  138. ---> %xxx:~3,2%=45
  139. ---> %xxx:~-3%=567
  140. ---> %xxx:~-3,2%=567
  141.  
  142. "%0 %1 %2 ... %9" is return the Value of "xxx.cmd x1 x2 x3 ... x9"
  143. * ---> %* <--- will take all argu that u write .!
  144. * %~1,~* == %1,%*
  145.  
  146. ..\xxx.cmd is argument %0 every argument that i add later will be %1 %2 %3
  147. like xxx.cmd test1 test2 > %1==test1 until 9.!
  148. instead of %X (x=0-9) u can use with <f,d,p,n,x,s,a,t,z, $PATH> & <0-9>
  149. an example %~dp0, %~tz8
  150.  
  151. :xxx >> can be used for make a function that can be call'd BY call\goto :xxx
  152. call go to this and return back to original place
  153. goto go there and stay there
  154. another Big diff is that call :XXX %XyZ% will make all :xxx 2 use %xyz% as %1 :)
  155. while goto can't be used like this only "goto :xxx"
  156.  
  157. |---> hmmmm one more thing <---|
  158.  
  159. @echo off
  160. call :test x,y -OR- call :test x y -OR- :test "x" "y"
  161. :test
  162. echo '%1','%2'
  163. pause
  164. --> will return 'x','y'
  165.  
  166. command | find "" or find /i ""
  167.  
  168. z=0
  169. set /a z+=1 ---> z=1
  170. set /a z=%z%+1 ---> z=1
  171.  
  172. if exist 'file\file's\folder\folder's' "command"
  173. if defined 'variable' "command"
  174. if "%xyz%"=="xyz" "command"
  175. - if \ if not
  176. - instead of |> "somthing"=="somthing" <| we can use this: EQU, NEQ, LSS, LEQ, GTR, GEQ
  177.  
  178. if x=%x% if y=%y% if z=%z% set somthing=???
  179. if x=%x% (if y=%y% if z=%z% set somthing=???)
  180.  
  181. * if defined \ exist \ errorlevel 'XYZ' +command+ -OR- (+command+)
  182. * if defined \ exist \ errorlevel 'XYZ' (+command+) else (+command+)
  183. * if defined \ exist \ errorlevel 'XYZ' (
  184. +command+
  185. ) else (
  186. +command+
  187. )
  188.  
  189. :something
  190. if xyz call
  191. if xyz call
  192. if xyz call
  193. goto something
  194.  
  195. :something
  196. if not xyz exit /b
  197. command
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement