DOS Select Jump implementation, DOS + BCP double-click Import and Export Data
@echo Off:start2 Clsgoto start:starttitle frequently used Websitesecho Please select a website from the Listecho with the corresponding Keyecho--------------------------------------echo [1] googleecho [2] wikipediaecho [3] facebookecho [4] Youtubeecho [5] yahooset input=set/p input= choice:if "%input%" = = "goto Nif%input%==1 goto Z if not goto start2if%INP ut%==2 goto X If not goto start2if%input%==3 goto C if not goto start2if%input%==4 goto V if not goto start2if%input%== 5 goto B If not goto start2if%input% GTR 5 goto N:zclsecho You have selected Googlepausestart Www.google.comexit:Xclsecho You had selected Wikipediapausestart Www.wikipedia.comexit:Cclsecho you had selected Facebookpausestart Www.facebook.comexit:Vclsecho you had selected Youtubepausestart Www.youtube.comexit:Bclsecho you had selected Yahoopausestart Www.Yahoo.comexit:Nclsecho Invalid selection! Try Againpausegoto:start2
@cls @echo Off@set "endfix=%date:~,4%-%date:~5,2%-%date:~8,2%-%time:~0,2%-%time:~3,2%-%time:~6,2%" @SETLOCAL Enableextensions@setlocal enabledelayedexpansion@echo ... @echo VALIDATE environment VARIABLES ... Rem +--------------- -----------------------------------------------------------+rem | VALIDATE Environment VARIABLES |rem +------------------------------------------- -------------------------------+ @set Msbackup=d:\salesorder_newdrm@set mslog=d:\salesorder_newdrm@set mstmp=d:\ Salesorder_newdrm@echo. @echo DECLARE All GLOBAL Variables...rem +------------------------------------------------ --------------------------+rem | DECLARE all GLOBAL VARIABLES. |rem +--------------------------------------------------------------------------+ @set Filename=salesorder@set db_ Username=drmpos@set Db_password=drmpos@set Tns_alias=drmprod@set Logfile=%mslog%\%filename%_%tns_alias%.log@set Dumpfile=%msbackup%\%filename%_%tns_alias%.datrem +--------------------------------------------------------------------------+rem | WRITE EXPORT PARAMETER FILE. |rem +--------------------------------------------------------------------------+ @echo ... @echo MOVE old EXPORT ( DUMP) File....rem +--------------------------------------------------------------------------+rem | MOVE old EXPORT (DUMP) FILE. |rem +--------------------------------------------------------------------------+ @if exist "%dumpfile%.backup" ( del/q "%dumpfile%.backup") @if exist%dumpfile% (echo f| @xcopy/y%dumpfile%%dumpfile%.backup) @if exist%logfile% (echo f|xcopy/y%logfile% "%logfile%.%endfix%") @if exist "%logfile%.%endfix%" (echo F | xcopy/y "%logfile%.%endfix%" D:\Sal esorder_newdrm\logfile\&del/q "%logfile%.%endfix%") @if exist%logfile% (del/q%logfile%) @echo ... @echo PERFORM Export...rem +--------------------------------------------------------------------------+rem | PERFORM EXPORT. |rem +--------------------------------------------------------------------------+rem exp parfile=%parfile% @bcp " SELECT * from Drmpos. SALESORDER where OrderDate >= convert (Date,getdate () -10) "Queryout%dumpfile%-t-c-t^| -D apoms-e%logfile% @IF not EXIST%logfile% GOTO end@echo ... error occured@echo SCAN the EXPORT LOGFILE for Errors...re m +--------------------------------------------------------------------------+rem | SCAN the EXPORT LOGFILE for ERRORS. |rem +--------------------------------------------------------------------------+ @echo ... @echo analyzing log file For errors ... @findstr/I/C: "Export terminated unsuccessfully"%logfile% @if errorlevel 1 (goto good1) Else (Goto exception ): End@echo @echo finished without errorlog@exit/b 0:good1@echo ... @echo analyzing log file for ms-errors ... @findstr/I /C: "Invalid"%logfile% @if ErrorleVel 1 (goto good2) Else (Goto exception): Good2@echo ... @echo analyzing log file for warnings ... @findstr/I/C: "Error"%log file% @if errorlevel 1 (goto good3) Else (Goto exception): Good3@echo ... @echo analyzing log file for warnings ... @findstr/I /C: "Rows"%logfile% @if errorlevel 1 (cmd/c exit 0) Else (Goto exception) @exit/b 0:exception@exit/b 1
- Mantis0000227_importsalesorder_autosys.cmd
@cls @echo Off@set "endfix=%date:~,4%-%date:~5,2%-%date:~8,2%-%time:~0,2%-%time:~3,2%-%time:~6,2%" @SETLOCAL Enableextensions@setlocal enabledelayedexpansion@echo ... @echo VALIDATE environment VARIABLES ... Rem +--------------- -----------------------------------------------------------+rem | VALIDATE Environment VARIABLES |rem +------------------------------------------- -------------------------------+ @set Msbackup=d:\salesorder_newdrm@set mslog=d:\salesorder_newdrm@set mstmp=d:\ Salesorder_newdrm@echo. @echo DECLARE All GLOBAL Variables...rem +------------------------------------------------ --------------------------+rem | DECLARE all GLOBAL VARIABLES. |rem +--------------------------------------------------------------------------+ @set Filename=salesorder@set db_ Username=drmpos@set db_password=drmpos@set tns_alias=drmprod@set logfile=%mslog%\imp_%filename%_%tns_alias%. Log@set Dumpfile=%msbackup%\%filenAme%_%tns_alias%.datrem +--------------------------------------------------------------------------+rem | WRITE EXPORT PARAMETER FILE. |rem +--------------------------------------------------------------------------+ @echo ... @echo MOVE old EXPORT ( DUMP) File....rem +--------------------------------------------------------------------------+rem | MOVE old EXPORT (DUMP) FILE. |rem +--------------------------------------------------------------------------+ @if exist "%dumpfile%.backup" ( del/q "%dumpfile%.backup") @if exist%dumpfile% (echo f| @xcopy/y%dumpfile%%dumpfile%.backup) @if exist%logfile% (echo f|xcopy/y%logfile% "%logfile%.%endfix%") @if exist "%logfile%.%endfix%" (echo F | xcopy/y "%logfile%.%endfix%" D:\Sal esorder_newdrm\logfile\&del/q "%logfile%.%endfix%") @if exist%logfile% (del/q%logfile%) @echo ... @echo PERFORM Export...rem +--------------------------------------------------------------------------+rem | PERFORM EXPORT. |rem +--------------------------------------------------------------------------+rem exp parfile=%parfile% @bcp Apoms.drmpos.SALESORDER in%dumpfile%-t-c-t^| -e%logfile% @IF not EXIST%logfile% GOTO end@echo ... error occured@echo SCAN the EXPORT LOGFILE for Errors...rem +------ --------------------------------------------------------------------+rem | SCAN the EXPORT LOGFILE for ERRORS. |rem +--------------------------------------------------------------------------+ @echo ... @echo analyzing log file For errors ... @findstr/I/C: "Export terminated unsuccessfully"%logfile% @if errorlevel 1 (goto good1) Else (Goto exception ): End@echo @echo finished without errorlog@exit/b 0echo ... echo analyzing log file for errors...findstr/i/C: "Import Terminated unsuccessfully "%logfile%if errorlevel 1 (goto good1) Else (Goto exception): Good1echo ... echo Analyzing log file for ora-errors...findstr/i/C: "Communication"%logfile%if errorlevel 1 (goto good2) Else (goto EXCEP tion): Good2echo ... echo analyzing log file for ora-errors...findstr/i/C: "Errors"%logfile%if errorlevel 1 (goto good3) Else (Goto exception): Good3echo. Echo analyzing log file for ora-errors...findstr/i/C: "Snapshot"%logfile%if Errorlev El 1 (Goto good4) Else (Goto exception): Good4echo ... echo analyzing log file for ora-errors...findstr/i/C: "TNS"%logfil e%if errorlevel 1 (goto GOOD5) Else (Goto exception): Good5echo ... echo analyzing log file for ora-errors...findstr/i/C: "Resource"%logfile%if errorlevel 1 (goto good6) Else (Goto exception): Good6echo ... echo analyzing log file for Ora-error s...findstr/i/C: "Deadlock"%logfile%if errorlevel 1 (goto good7) Else (Goto exception): Good7echo ... echo analyzing log f Ile for ora-errors...findstr/i/C: "identifier"%logfile%if errorlevel 1 (goto good8) Else (Goto exception): Good8echo. . Echo Analyzing log fileFor ora-errors...findstr/i/C: "Maximum"%logfile%if errorlevel 1 (goto good9) Else (Goto exception): Good9echo ... echo an Alyzing log file for ora-errors...findstr/i/C: "Shutdown"%logfile%if errorlevel 1 (goto GOOD10) Else (Goto exception): g Ood10echo. Echo Analyzing log file for warnings...findstr/i/C: "Unable"%logfile%if errorlevel 1 (cmd/c exit 0) Else ( Goto exception) Exit/b 0:exceptionexit/b 1
Copyright notice: This article Bo Master original articles, blogs, without consent may not be reproduced.
DOS Select Jump implementation, DOS + BCP double-click Import and Export Data