dos - Generate the .bat file that will copy the selected lines from the .bat file (within .bat file) to another text file -


@echo off :start cls title or unlike :1 echo. set/p _file=output file name: echo. echo select type echo (1)like. (2)unlike echo. set/p _num=enter option: if %_num%==1 goto if %_num%==2 goto unlike :like echo. copy below lines "%_file%" land beautiful wanna stay here etc........ etc........ exit :unlike echo. copy below lines "%_file%" land ugly hate land exit 

i want creat .bat file copy selected lines .bat file (within .bat file) text file

@echo off setlocal :start cls title or unlike :1 echo. set/p _file=output file name: echo. echo select type echo (1)like. (2)unlike echo. set/p _num=enter option: if %_num%==1 call :show like&goto :eof if %_num%==2 call :show unlike&goto :eof  echo bad option goto :eof  :show set "out=" /f "usebackq tokens=1*" %%i in ("%~dpnx0") ( if /i %%i==exit set "out=" if defined out >>"%_file%" echo %%i %%j if /i %%i==:%1 set out=y ) goto :eof   :like land beautiful wanna stay here etc........ etc........ exit :unlike land ugly hate land exit 

here's starter. isn't perfect. note %~dpnx0 (or %~f0) drive path name extension of 0'th batch parameter, batch file itself


Comments