exit-code

Can I get an exit code from running regedit /s?

我的梦境 提交于 2019-12-11 04:14:48
问题 I have a script that changes a registry value, before doing that, it makes a backup of the registry key using regedit /e to create a .reg file. If the script is run a second time and the .reg backup file exists, I am asking the user if they want to add their backup back into the registry. Because I don't want to confuse users who will have no real idea of whats happening with extra prompts they might not understand, I am using the following code to do this with out asking the user if they

Meaning of JVM exit code 10

和自甴很熟 提交于 2019-12-11 03:19:46
问题 I got the below message when the JVM exited: JVM process exited with a code of 10 What is the meaning of exit code 10? 回答1: The JVM yields the exit code specified by the program with System.exit(code). If the JVM crashed it's OS specific what the exit code could mean 来源: https://stackoverflow.com/questions/994752/meaning-of-jvm-exit-code-10

SQL*Plus : Force it to return an error code

梦想与她 提交于 2019-12-11 00:09:35
问题 I have a stored procedure that has an OUT parameter, indicating an error code. If the error code is not 0, then I raise an error DECLARE BEGIN foo (err_code); IF (err_code <> 0) THEN raise_application_error(...); END; So far so good, but here's my question. This piece of code (shown above) is executed by sqlplus, which is called from a shell script, which should exit with 0 / not 0 (as the sql script). #shell script sqlplus ... @myscript return $? When the raise_application_error executes,

Specify exit code in batch exit

你说的曾经没有我的故事 提交于 2019-12-10 23:57:19
问题 I need to specify my own exit code in my batch script when it successful exits on a if exist clause. As you will notice, I specified it as an exit 5 , I have also tried exit /b 5 but nothing has worked. Any suggestions? @ECHO OFF CLS set SOURCE_PARENT=%1 set FOLDER=%2 set TARGET_FILE=%3 net use S: %SOURCE_PARENT% net use T: %TARGET_FILE% if exist T:\%FOLDER% ( echo Folder exists, process exiting net use S: /Delete /y net use T: /Delete /y exit 5 ) else ( mkdir T:\%FOLDER% ) xcopy S:\%FOLDER%

Exit code “lost” from child process in Windows XP, not in Windows Server 2003

浪尽此生 提交于 2019-12-10 22:46:25
问题 EDIT 3 OK, so it seems like this might not be an Installer issue after all. When I make a simple batch file: exit /b 12 and call it as cmd /c test.cmd echo %ERRORLEVEL% I get "12" on Windows Server 2003 R2, but "0" on XP. I thought I had tested this simple test case many times before but apparently not. So, I've changed the tags and title but I'm leaving the other information here as there's actually a lot of useful stuff here that is not directly related to this issue. Thoughts? Original

How to catch the exit code of a CMDEXEC SQL Server Job?

泄露秘密 提交于 2019-12-10 19:08:38
问题 The following SQL Server job always exits with return code 0 indicating success, when in fact it does not do its job, i.e. it does not delete "test.txt". How can I catch the actual exit code (something like %ERRORLEVEL%, or a 'permission denied'-like message, or any meaningful response indicating success or failure of @command at msdb.dbo.sp_add_jobstep)? Remarks: {DBname} is the name of the database I am the owner of {proxyName} is the name of the SQL Server Agent Proxy (that is active to

Obtaining exit status values from GNU parallel

旧时模样 提交于 2019-12-10 17:15:50
问题 The Perl wrapper below executes commands in parallel, saving STDOUT and STDERR to /tmp files: open(A,"|parallel"); for $i ("date", "ls", "pwd", "factor 17") { print A "$i 1> '/tmp/$i.out' 2> '/tmp/$i.err'\n"; } close(A); How do I obtain the exit status values from the individual commands? 回答1: To get the exist status of the individual jobs, parallel would need to write the info somewhere. I don't know if it does or not. If it doesn't, you can do that yourself. my %jobs = ( "date" => "date",

Exit code of a process terminated with Process.Kill() , in C#

点点圈 提交于 2019-12-10 15:35:58
问题 If in my C# application, I am creating a child process that can either terminate normally, or start misbehaving, in which case I terminate it with a call to Process.Kill().However, I would like to know if the process has exited normally.I know I can get the error code of a terminated process, but what would be a normal exit code and what would signify that the process was killed? 回答1: You can use the property ExitCode but unfortunately this depends on how the app is built. So if you have the

Powershell Copy-Item Exit code 1

荒凉一梦 提交于 2019-12-10 11:41:38
问题 I have a script with several files I'd like to copy and I do it more or less like so. Copy-Item xxx1 yyy1 -Force Copy-Item xxx2 yyy2 -Force Copy-Item xxx3 yyy3 -Force Copy-Item xxx4 yyy4 -Force and so on. Now I'd like this script to exit with 1 if any of the files was not copied. Thanks in advance 回答1: What you're asking for is similar to the set -e option in bash , which causes a script to exit instantly in the event that a command signals failure (except in conditionals) [1] . PowerShell

Capturing exit status from STDIN in Perl

强颜欢笑 提交于 2019-12-10 11:08:36
问题 I have a perl script that is run with a command like this: /path/to/binary/executable | /path/to/perl/script.pl The script does useful things to the output for the binary file, then exits once STDIN runs out (<> returns undef). This is all well and good, except if the binary exits with a non-zero code. From the script's POV, it thinks the script just ended cleanly, and so it cleans up, and exits, with a code of 0 . Is there a way for the perl script to see what the exit code was? Ideally, I'd