Getting the output of a batchfile to Powershell
Greetings. I have a list of batchfiles that triggers Powershell script, that will throw error message when different errors were encountered in the execution.
In the end of the batchfile, I have included:
if %errorlevel% neq 0 (echo error in previous command & exit /b %errorlevel%)
and it works fine in itself.
However due to some requirements I need to use new separate batchfile that triggers a Powershell, that will in turn lauch the batchfiles mentioned earlier.
In the new Powershel, I have included:
$process = start-process $batchFile.FullName -ArgumentList $argumentList -PassThru -Wait
and is able to get $process.ExitCode. However I would like to get the output or error message that would be raised from the first batchfile instead.
Any advice?
Hi Bdrc,
If you want to capture the output of the batch file, please try to run the batch file like:
d:\test.bat argu1 argu2
And the cmdlet start-process will start a process with the batch file.
For more detailed information, please refer to this article:
How to Execute a .bat File within a PowerShell Job
If there is anything else regarding this issue, please feel free to post back.
Best Regards,
Anna Wang
Similar Messages
-
Are You All Able to get the Output In EXCEL Format
Hi All,
I have one question. Are You All Able to get the Output In EXCEL Format?? I am working on Oracle Apllication 11.5.10.2 and my XML builder is 5.0.1. Problem which i m facing is this...... Whenever i am submitting a concurrent program with format type different from PDF i could not able to view the ouput in desired format. When i am pressing view output it gives me a file in XML and when i save that file with extention 'xls' or 'rtf' then i could able to see the saved file in desired format.
Can anyone tell me where is the problem??? Is it a bug?
I am using microsoft world 2000 sp-3.
Please give your valuable comments. May be your comments can solve my problem..
Thanks
RaviHi I got Same issue
When I change Format to EXCEL from
Submit request>> Option>> Format = EXCEL
In window I am getting something HTML code and
when I try to copy it to Browser from Tools>> Copy File in to Browser I am getting following message
The XML page cannot be displayed
Cannot view XML input using XSL style sheet. Please correct the error and then click the Refresh button, or try again later.
End tag 'p' does not match the start tag 'a'. Error processing resource 'http://our url.com:8000/OA_CGI...
<p class="c0"><a name="Text4" id="Text4"><a name="Text1_1" id="Text1_1"><span class="c1">Dept No <...
But I can see the output when Format is PDF
Pls suggest solution ,I am using EBS 11.5.10.2.
Thanks
Rahul
Message was edited by: Rahul
user576181 -
How to get the output of a standard report RFBILA00 in PDF form.
hi,
I have to get the output of the standard report RFBILA00 in the PDF form.
Thanks.Hi Rao,
you can run your report RFBILA00 in background and in background job you can add one more step, next in that step you can add custom report like zsubmit .
job should be set like
step1: RFBILA00 with variant.
Step2: zsubmit report with variant.
In Zsubmit report you can read, your first step spool using FM GET_JOB_RUNTIME_INFO
and pass that spool in the FM CONVERT_ABAPSPOOLJOB_2_PDF.
when second report run in job you can set your target like download in the server or send email etc.
Regards,
Prasenjit -
How to get the output of a procedure in to a log file ?
Hi, Everyone,
Could you please tell me
How do i write the output of a procedure to a log file ?
Thanks in advance...Hi,
could you please explain me more on how to use the UTL_file to get the output to a log file as in am new to PL/SQL
my script file is
EXEC pac_sav_cat_rfv.pro_cardbase (200910,'aaa',100,'test_tbl');
i need the output of this statement in a log file.
Could you please explain to me how it can be done.
thanks in advance -
Is it possible to get the output of a text container into Spool..?
Hi
I am trying to write a report for a standard transaction(SM65) in BDC and run thru background job so as to get the output in to Spool. Right now I am facing an issue to get the SM65(text container) tcode output into spool.
FYI..I am using "CALL TRANSACTION 'SM65' USING BDCDATA MODE 'E'."
Please provide tour valuable inputs.
Thanks!
ShivHi Shiv,
Instead of writing BDC for T-code SM65 I would suggest you to use following function module to get the required data.
CALL FUNCTION 'BPT_ANALYSE_START'
EXPORTING
server_name = servername_tmp
check_all_btc_servers = sbpt1020-allsrvchk
profile_check = sbpt1020-profilechk
xpgm_environment_check = sbpt1020-xpgmcheck
TABLES
protocol_tbl = global_protocol_tbl
EXCEPTIONS
OTHERS = 99.
Once you got the data into "global_protocol_tbl " you can create spool of it. -
NOOB Question - Cannot seem to get the output in a text or CSV file - Please help!!
I was able to put together a script which finds members of a certain AD group, filters down the users, and then calculates the number of days till a password reset is needed. I am able to get on screen exactly what i am looking for, but cannot seem
to figure out how to get the same data to a file. What i am doing wrong? two goals here:
1. Create a spreadsheet with a list of users whose password is about to expire.
2. Down the line automate an email to users whose password is about to expire.
Here is my code:
## Get List Of Users in Password Change Lockout that do not have an expired password or a password that never expires
$Names = (Get-ADGroupMember -Identity "Password Change Lockout" -Recursive |`
Get-ADUser -Properties * |`
Where-Object {$_.PasswordNeverExpires -eq $False -and $_.PasswordExpired -eq $False} |`
Sort-Object name |Select-Object -ExpandProperty SamAccountName)
## Get Password last Set values for all
Foreach ($Name in $Names)
$VAR1 = (Get-ADUserResultantPasswordPolicy -Identity $Name).MaxPasswordAge
$VAR2 = (Get-ADUser $Name -Properties *).passwordlastset
$VAR3 = (Get-ADUser $Name -Properties *).name
$DTPC = (New-TimeSpan -Start (Get-Date) -End ($VAR2 + $VAR1) | Select-Object -ExpandProperty Days)
Filter users to those who need to change thier password in 15 days.
If ($DTPC -lt 15)
No matter what i try between the {} after the If statement, I cannot get the output to a file. However, if I use a Write-Output I get exactly what i looking for. I feel like i am forgetting some basic concept and could really use some help. Thanks.
Matt
Matt DillonHi Matt,
I generally create an empty array (something like $out = @()) at the top of the script and then use $out += $desiredOutput inside of the foreach loop.
Outside of the loop, you can then pipe $out to Out-File or Export-Csv, depending on your needs.
Don't retire TechNet! -
(Don't give up yet - 12,830+ strong and growing) -
How to get the output path in Java?
Hi all,
is there a way (method) to get the output path (where compiled classes are put) in Java?
thx a lot!
MicheleIf you have already successfully loaded the classes into memory, and you want to find out where the classes are physically stored, then you can use Class.getResource() to retrieve the location of the file.
import java.net.URL;
public class Find
private void run(String obj) {
try {
Class cls = Class.forName(obj);
//Here is the change to input correct resource path
//instead of class name
String resourcePath = "/"+obj.replace('.','/')+".class";
URL url = cls.getResource(resourcePath);
System.out.println(url);
catch (Exception e) {
e.printStackTrace();
public static void main(String[] args) {
Find find = new Find();
find.run(args[0]);
}java Find java.lang.String
jar:file:/usr/local/j2sdk1.4.2_13/jre/lib/rt.jar!/java/lang/String.class
Edited by: Jin on Oct 23, 2007 10:38 AM -
How to get the output format options of SAP QUERY
Hi Gurus,
I want to get the output options available for sapquery program.means when you execute the program "AQZZ/SAPQUERY/FDF1============" you will get output options like sap alv,display as table,wordprocessing etc.
i am not able to unsderstand the logic in that standard code.my requirement is after fetching the data from the database i want to provide the ouput options SAP ALV,DISPLAY AS TABLE,WORD PROCESSING,SPREAD SHEET,FILESTORE.
I can output the data in SAP ALV and i can store the data.But i am not able to use the the remaining options in my program.please provide me solution.
I am very much thankful to the people who can provide me the solution.Hi,
If you have a query then go to transaction 'SQ01' . Then press the change button . Then u will able to see the Output Options.Their u can select the option what ever u want. -
ABAP Program where iam not able to get the Output.
Hi Team,
I have written the code for the following requirement but could not get the output
Can you people please have a look at this.
Create a Report with the following output.
In the selection screen you should have KUNNR and Delivery date(VBEP-EDATU).
When you select the Customer number and Date in the Selection the following output should be displayed.
Sales order Number (VBAK-VBELN)
Sales order Material (VBAP-MATNR)
Quantity (VBAP-ZMENG)
Ship-to-Party (VBAK-KUNNR)
Delivery Number(LIKP-LFDAT).
The key field used for fetching the values is VBELN.
Here the values from table VBAK are not getting selected.
Please check the Program and give your valuable suggestion.
I checked in Debug mode but could not get the values
Regards,
Pradeep P.Hi Ramchand,
Plz find the Code.
*Fetching vbeln matnr zmeng kunnr from vbak and vbap
select a~vbeln
b~matnr
b~zmeng
a~kunnr
into corresponding fields of table it_sales
from vbak as a
inner join vbap as b
on avbeln = bvbeln
where a~kunnr in s_kunnr.
If sy-subrc = 0.
sort it_sales by vbeln.
endif.
*Fetching vbeln edatu lfdat from vbep and likp
select a~vbeln
a~edatu
b~lfdat
into corresponding fields of table it_delivery
from vbep as a
inner join likp as b
on avbeln = bvbeln
for all entries in it_sales
where a~vbeln = it_sales-vbeln
and a~edatu in s_edatu.
Regards,
Pradeep P. -
To get the output in the chart for a single selection
Hi all,
I used a query to get the output of the table, and for the same query i have created a view to get the result in the chart.
to get the output of the table for a particular region i have created an input field and added value help to it. When i selected one particular region, i will be getting the data, in the table. But when i select a particular row in the table i need to get the data of that particular row only in the chart. (which i am getting)
But when i select multiple regions at a time, then i am facing the issue. I get result of multiple regions data(at a time two rows are displayed in the chart) in the chart. where in i want to get data only for one region (only one row needs to get selected at a time) to get the result.
Can any one throw a light of what needs to be done here.
Thanks,
RaniHi Rani,
I am not sure if I understand your question exactly, but it sounds like you need to set the selection mode for your table to "Single". If you do that the user will only have the possibility of selecting one row at a time in the table; they will not be able to select multiple rows.
You make that setting in the Configure Element panel for the table.
I hope this suggestions helps.
Margaret -
How to get the output in ALV format
Hi All,
this is my program, in this i want to get the output in ALV, i hv created two containers and m able to get the ALV layout successfully but i am not able to fetch the correct data.
the output it is showing is some RFC value.
here we have used - abaplist, soli.
Please provide me the solution.
SELECT * FROM varid INTO CORRESPONDING FIELDS OF TABLE t_varid WHERE report in s_report.
LOOP AT t_varid .
SUBMIT (t_varid-report) USING SELECTION-SET t_varid-variant
EXPORTING LIST TO MEMORY
AND RETURN.
CALL FUNCTION 'LIST_FROM_MEMORY'
TABLES
listobject = listtab
EXCEPTIONS
not_found = 1
OTHERS = 2.
**************Old System Entry********
CALL FUNCTION 'Z_GET_DETAILS'
DESTINATION 'BWDCLNT900'
EXPORTING
report = t_varid-report
variant = t_varid-variant
TABLES
listtab = list_tab.
IF sy-subrc EQ 0.
CALL FUNCTION 'LIST_TO_TXT'
TABLES
listtxt = listtxt1
listobject = list_tab
EXCEPTIONS
empty_list = 1
list_index_invalid = 2.
ENDIF.
if p_flag eq 'X'.
clear p_flag.
write : / 'Program Name',
41 'Variant Name',
66 'Output Match'.
endif.
IF listtxt EQ listtxt1.
WRITE : / t_varid-report,
41 t_varid-variant,
66 icon_green_light AS ICON HOTSPOT.
ELSE.
WRITE : / t_varid-report,
41 t_varid-variant,
66 icon_red_light AS ICON HOTSPOT.
ENDIF.
CLEAR : listtab,list_tab,listtxt,listtxt1.
REFRESH : listtab[],list_tab[],listtxt[],listtxt1[].
ENDLOOP.
AT line-selection.
v_report = sy-lisel(40).
v_variant = sy-lisel+40(14).
call SCREEN 400.
module STATUS_0400 output.
SUBMIT (v_report) USING SELECTION-SET v_variant
EXPORTING LIST TO MEMORY
AND RETURN.
CALL FUNCTION 'LIST_FROM_MEMORY'
TABLES
listobject = listtab
EXCEPTIONS
not_found = 1
OTHERS = 2.
CALL FUNCTION 'LIST_TO_TXT'
TABLES
listtxt = listtxt1
listobject = list_tab
EXCEPTIONS
empty_list = 1
list_index_invalid = 2.
**************Old System Entry********
CALL FUNCTION 'Z_GET_DETAILS'
DESTINATION 'BWDCLNT900'
EXPORTING
report = v_report
variant = v_variant
TABLES
listtab = list_tab.
CREATE OBJECT CCONT1
EXPORTING
CONTAINER_NAME = 'C1'.
CREATE OBJECT CCONT2
EXPORTING
CONTAINER_NAME = 'C2'.
CREATE OBJECT GRID1
EXPORTING
I_PARENT = CCONT1.
CREATE OBJECT GRID2
EXPORTING
I_PARENT = CCONT2.
CALL METHOD GRID1->SET_TABLE_FOR_FIRST_DISPLAY
EXPORTING
I_STRUCTURE_NAME = 'abaplist'
CHANGING
IT_OUTTAB = list_tab.
CALL METHOD GRID2->SET_TABLE_FOR_FIRST_DISPLAY
EXPORTING
I_STRUCTURE_NAME = 'abaplist'
CHANGING
IT_OUTTAB = listtab.
SET PF-STATUS 'ZUTDEMO2'.
endmodule.
module USER_COMMAND_0400 input.
IF SY-UCOMM = 'EXIT'.
LEAVE PROGRAM.
ENDIF.
endmodule. " USER_COMMAND_0400 INPUTsolved
-
Getting the output from a Perl script using Runtime.exec
I cannot get the output from a perl script using Java. Can someone PLEASE help?
I used the following code:
Process p = Runtime.getRuntime().exec("C:\\Perl\\bin\\Perl.exe script.pl) ;
InputSream in = p.getInputStream();
b...
do
System.out.println(b);
while ((b = in.read()) > 0)
But there is no way that I get the output in the inputstream. If I use the command "cmd script.pl", the output is displayed in the Dos box, but also not in the inputstream.
I will appreciate any help.Try this
Process p = Runtime.getRuntime().exec("C:\\Perl\\bin\\Perl.exe script.pl) ;
BufferedReader rd = new BufferedReader(new InputStreamReader(p.getInputStream()));
String str;
while((str=rd.readLine())!=null){
System.out.println(str);
Manu -
How to get the Output File Name as One of the Field Value From Payload
Hi All,
I want to get the Output file name as one of the Field value from payload.
Example:
Source XML
<?xml version="1.0" encoding="UTF-8" ?>
- <ns0:MT_TEST xmlns:ns0="http://sample.com">
- <Header>
<NAME>Bopanna</NAME>
</Header>
</ns0:MT_TEST>
I want to get the Output file name as " Bopanna.xml"
Please suggest me on this.
Regards
BopannaHi,
There are couple of links already available for this. Just for info see the below details,
The Output file name could be used from the field value of payload. For this you need to use the UDF DynamicFile name with below code,
// Description: Function to create dynamic Filename
DynamicConfiguration conf = (DynamicConfiguration) container.getTransformationParameters().get(StreamTransformationConstants.DYNAMIC_CONFIGURATION);
DynamicConfigurationKey key = DynamicConfigurationKey.create("http://sap.com/xi/XI/System/File" , "FileName");
conf.put(key,a);
return "";
DynamicConfiguration conf = (DynamicConfiguration) container.getTransformationParameters().get(StreamTransformationConstants.DYNAMIC_CONFIGURATION);
DynamicConfigurationKey key = DynamicConfigurationKey.create("http://sap.com/xi/XI/System/File" , "FileName");
conf.put(key,a);
return "";
With this udf map it with the MessageType as
(File Name field from Payload) > DynamicFileConfiguration>MTReceiver
Thanks
Swarup -
In oracle Httpuritype - Not getting the output correctly
Hi, I am trying out httpuritype in oracle for the first time. My requirement is to get the input string and the from_language and to_language and has to be converted accordingly.
I am using oracle 11.2.0.1.
So had setup acl explicitly and started writing the below program.
create or replace procedure trans_new_prc1
(p_words in varchar2, -- words to be translated
p_to in varchar2 , -- language to translate to
p_from in varchar2 ) -- language to translate from
is
l_res varchar2(2000);
l_words varchar2(2000);
txt varchar2(2000);
begin
txt:=utl_url.escape(l_words);
l_words:=regexp_substr(httpuritype('http://translate.google.co.in/?hl=en&tab=wT#'||p_from||'/'||p_to|| txt).getclob(),'"(.*?)"',1,1,null,1);
Dbms_output.put_line( l_words);
end;
While converting from polish language to english language I get the output as
SQL> exec trans_new_prc1('hen','pl','en');
text/html; charset=ISO-8859-2
But i need the exact string in polish language, which i am not getting. Please guide me.
Even while converting it into chinese language, i get the following message
SQL> exec trans_new_prc1('hen','zh-CN','en');
text/html; charset=ISO-8859-2
Please guide me to get the output exactly in chinese language.I think the problem is, google translate is not giving that info with this URL ! I removed REGEXP_SUBSTR and get all html code from HTTPURITYPE, in returned code, there is no translated word info!
for the code
exec trans_new_prc1('hen','ENGLISH','AUTO');result is:
<!DOCTYPE html><html><head><meta content="text/html; charset=ISO-8859-1" http-equiv="content-type"><meta name=keywords content="translate, translations, translation, translator, machine translation, online translation"><meta name=description content="Google's free online language translation service instantly translates text and web pages. This translator supports: English, Afrikaans, Albanian, Arabic, Armenian, Azerbaijani, Basque, Belarusian, Bengali, Bulgarian, Catalan, Chinese, Croatian, Czech, Danish, Dutch, Esperanto, Estonian, Filipino, Finnish, French, Galician, Georgian, German, Greek, Gujarati, Haitian Creole, Hebrew, Hindi, Hungarian, Icelandic, Indonesian, Irish, Italian, Japanese, Kannada, Korean, Latin, Latvian, Lithuanian, Macedonian, Malay, Maltese, Norwegian, Persian, Polish, Portuguese, Romanian, Russian, Serbian, Slovak, Slovenian, Spanish, Swahili, Swedish, Tamil, Telugu, Thai, Turkish, Ukrainian, Urdu, Vietnamese, Welsh, Yiddish"><meta name=robots content=noodp><meta name=google content=notranslate><link rel="canonical" href="http://translate.google.com/"><title>Google Translate</title><link rel="search" type="application/opensearchdescription+xml" href="/opensearch.xml?hl=en" title="Google Translate"><script>function _gtErr(e){var i=new Image();i.src='/gen204?jserr='+encodeURIComponent(e+": "+e.stack).substr(0,2000);i.onload=function(){i.onload=null;};}window.onerror=_gtErr;</script><script>(function(){var ti_a=function(b){this.t={};this.tick=function(b,c,a){a=void 0!=a?a:(new Date).getTime();this.t=[a,c]};this.tick("start",null,b)},ti_b=new ti_a;window.jstiming={Timer:ti_a,load:ti_b};if(window.performance&&window.performance.timing){var ti_c=window.performance.timing,ti_d=window.jstiming.load,ti_e=ti_c.navigationStart,ti_f=ti_c.responseStart;0<ti_e&&ti_f>=ti_e&&(ti_d.tick("_wtsrt",void 0,ti_e),ti_d.tick("wtsrt_","_wtsrt",ti_f))}
there is no "THEM" (translated word) in it. (I couldnt write whole returned info because exceed post limits.) -
How to get the output of the report in pdf format
how to get the output of the report in pdf format?
Thanks in advance,
madan.Refer these links
http://www.sap-img.com/bc037.htm
http://www.members.tripod.com/abap4/Save_Report_Output_to_a_PDF_File.html
CONVERT_ABAPSPOOLJOB_2_PDF FM convert abap spool output to PDF
Maybe you are looking for
-
Contract Value Calulation based on Start & End Time
Hello Friends, My client is into Vessel Hiring & the Vessels are given on hire for fixed period (with clear start & end dates & time). For the above scenario we have a Periodic Contract to BIlling cycle which generates Invoices for every month. whil
-
I have a new purchase iMac, after a while of use, I discover that there is some ripple display on the top right corner. Send back to apple, they said there is external water go inside. But truly, this is not real, it might inherent with this problem
-
I'm a web developer, I use DW a lot - I haven't been able to get DW to load all day long. It locks up on "initializing extension data" and will load no further. I've uninstalled and re-installed the program and have updated it with no success. PLEASE
-
Hi all. I have an apex 4.0.2 page with two regions: HTML Region with a group of itens and manual tabular form region(using apex_item). On the page i have three PLSQL processes : -The first inserts values in a table, using item values from the HTML re
-
Share iPhoto library on one iMac
Sorry if this is answered elsewhere, but is there a simple way in iPhoto 08 for all users on my iMac to share a single library? I have the library on an external drive and vaguely remember having to do all sorts of fiddling so that others could see i