Output of cmd in command prompt as key and vaule in properties file

hi,
i want to get the value of any command which i run using cmd in a properties file as a key and value rather then getting it in text file
for example - hostname>output.txt   [not good], i want it to be like hostname>output.properties with a key and its value as output.
command - `hostname`
output - userpc
but i want the same output in a properties file like
xyzkey=userpc   in sample.properties file.
it would be a great help.
thanks
sid

I am sorry to say that it is not possible to understand what you are asking.
Please post a copy of your script with any error messages.
¯\_(ツ)_/¯

Similar Messages

  • Redirecting output to J2EE server command prompt

    I am finding difficulty with reading the system.out.println() given in the server side code. J2SDK redirects it to System.out file, but most of the time, I am not
    getting the results. I tried to restart the server to get the value from buffer.
    But thats not working either. Is there any way for getting the output in the server prompt itself. Can I do any configuration changes for this.

    Start the J2EE server from the command prompt with "-verbose" option.
    Regards,
    Ashoke Bhowmick

  • Ipad stuck on logo and a command prompt shows up and then freeze.

    my Ipad suddenly blackout, the screen is totally black but the backlight is still on, i can't seem to shut it down even I press the power buttons in a long period of time, then I waited more than a day until it runs out of battery to shut down itself. when I turn it on the apple logo show up the the backlight becomes dim and a command prompt shows up on the screen at left corner, then it restart and keep doing on and on until the apple logo only pops out the freeze and a couple of minutes later it backs-out and have to wait for it to runs out battery again. pls. help.

    Your iPad probably might to be serviced or replaced. I don't think that there is much in the way of troubleshooting that you can do other than to restore to factory settings. You will end a computer running iTunes in order to restore to factory settings. If you can't attempt this for whatever reason, make an appointment at an Apple Store and ask for their help.
    Use iTunes to restore your iOS device to factory settings

  • Command Prompt Output to a File

    hi,
    i am new to java, i would like to write a program which executes a command in command prompt, giving some result and want to read this command prompt output to a file like this:
    1) first i need to exeucte "dir c:" command which will give the details fo that particular directory
    2) the output displyed on the command prompt by executing the above command has to be read into a File.
    help me with some code snippets to do this.
    Thanks in advance.

    could you please elaborate the explanation interms of
    java code snippets?
    rofl
    Read this.
    http://www.javaworld.com/javaworld/jw-12-2000/jw-1229-traps.html?page=3

  • How can I pass a value to the command prompt?

    I was wondering how can I pass a value to the command prompt with Windows and Linux? I'm more interested in Linux's system than Windows though. Is there a way to return info from the command prompt?

    Here is a snippet from http://mindprod.com/jglossexec.html that explains how in detail.
    Runtime.getRuntime().exec("myprog.exe") will spawn an external process that runs in parallel with the Java execution. In Windows 95/98/ME/NT/2000/XP, you must use an explicit *.exe or *.com extension on the parameter. It is also best to fully qualify those names so that the system executable search path is irrelevant, and so you don't pick up some stray program off the path with the same name.
    To run a *.BAT, *.CMD, *.html *.BTM or URL you must invoke the command processor with these as a parameter. These extensions are not first class executables in Windows. They are input data for the command processor. You must also invoke the command processor when you want to use the < > | piping options, Here's how, presuming you are not interested in looking at the output:
    Runtime.getRuntime( ).exec ("command.com /E:1900 /C MyBat.bat" );
    Runtime.getRuntime( ).exec ("cmd.exe /E:1900 /C MyCmd.cmd" );
    Runtime.getRuntime( ).exec ("C:\\4DOS601\\4DOS.COM /E:1900 /C MyBtm.btm" );
    Runtime.getRuntime( ).exec ("D:\\4NT301\\4NT.EXE /E:1900 /C MyBtm.btm" );
    There are also overloaded forms of exec(),
    Runtime.getRuntime( ).exec ("command.com /E:1900 /C MyBat.bat", null);
    Runtime.getRuntime( ).exec ("command.com /E:1900 /C MyBat.bat", null, "C:\\SomeDirectory");
    The second argument can be a String [], and can be used to set environment variables. In the second case, "C:\\SomeDirectory" specifies a directory for the process to start in. If, for instance, your process saves files to disk, then this form allows you to specify which directory they will be saved in.
    Windows and NT will let you feed a URL string to the command processor and it will find a browser, launch the browser, and render the page, e.g.
    Runtime.getRuntime( ).exec ("command.com http://mindprod.com/projects.html" );
    Another lower level approach that does not require extension associations to be quite as well set up is:
    Runtime.getRuntime( ).exec ("rundll32 url.dll,FileProtocolHandler http://mindprod.com/projects.html" );
    Note that a URL is not the same thing as a file name. You can point your browser at a local file with something like this: file://localhost/E:/mindprod/jgloss.html or file:///E|/mindprod/jgloss.html.
    Composing just the right platform-specific command to launch browser and feed it a URL to display can be frustrating. You can use the BrowserLauncher package to do that for you.
    Note that
    rundll32.exe url.dll,FileProtocolHandler file:///E|/mindprod/jgloss.html
    won't work on the command line because | is reserved as the piping operator, though it will work as an exec parameter passed directly to the rundll32.exe executable.
    With explicit extensions and appropriately set up associations in Windows 95/98/ME/NT/2000/XP you can often bypass the command processor and invoke the file directly, even *.bat.
    Similarly, for Unix/Linux you must spawn the program that can process the script, e.g. bash. However, you can run scripts directly with exec if you do two things:
    Start the script with #!bash or whatever the interpreter's name is.
    Mark the script file itself with the executable attribute.
    Alternatively start the script interpreter, e.g.
    Runtime.getRuntime( ).exec (new String[]{"/bin/sh", "-c", "echo $SHELL"}";

  • Call an ABAP program or a function module from command prompt/python script

    Dear All,
    I want to call a function module/ABAP program from command prompt or a python script.
    Let me explain with an example.
    There is a function module "z_add" that takes  two integers as input parameters and generates their sum.
    the sum is the output parameter.
    Now i want to call this function module from command prompt / python script and pass parameters to this function module.
    In return i must get the sum(i.e. the output of function module).
    I tried using STARTRFC ,was able to call the FM but could not get the return value(output) from FM.
    Can you please provide me the code of such a function module and the method to call it thereby passing parameters and getting the sum.
    Thanks and regards,
    Gaurav
    Edited by: gauravkec2005 on Mar 4, 2010 7:41 AM

    thank you both!  helpful answers! :o)
    anyway! 
    i have written the program which is called from the SAPScript:
        /:       PERFORM GET_VATNUMBER IN PROGRAM ZFI_F140_OPERATIONS
        /:       USING &BKPF-BUKRS&
        /:       CHANGING &VATNUMBER&
        CE       VAT Registration No : &VATNUMBER&
        REPORT zfi_f140_operations.
        FORM get_vatnumber TABLES in_par  STRUCTURE itcsy
                                  out_par STRUCTURE itcsy.
          DATA: lv_co_code TYPE bukrs,
                lv_vat_no  TYPE stceg.
          READ TABLE in_par WITH KEY name = 'BKPF-BUKRS'.
          MOVE in_par-value TO lv_co_code.
          SELECT SINGLE stceg FROM t001
            INTO lv_vat_no WHERE bukrs = lv_co_code.
          out_par-name = 'VATNUMBER'.
          WRITE lv_vat_no TO out_par-value.
          CONDENSE out_par-value.
          MODIFY out_par INDEX 1.
        ENDFORM.              
    it is not working and i cannot work out why... 
    i have not been ABAPing for very long but have had a go.... 
    any thoughts as to what i have done wrong?
    or point me where i should be looking?  thank you!

  • Error while Invoking SQLPLUS from Command Prompt

    Hi All,
    I am trying to Connect to Oracle through sqlplus from command prompt of windows and getting this Error:
    C:\Documents and Settings>sqlplus
    SQL*Plus: Release 10.2.0.1.0 - Production on Thu Dec 28 10:08:43 2006
    Copyright (c) 1982, 2005, Oracle. All rights reserved.
    Enter user-name: scott
    Enter password:
    ERROR:
    ORA-12560: TNS:protocol adapter error
    set ORACLE_SID=database_name was set
    Anyone ever got this error or has any idea could you please help.
    Thanks.

    Try
    set LOCAL=<tns_name>
    Regards
    Kurt

  • Display key and text by WAD command in custom structure hierarchy

    Hi everybody,
    I have a query using a custom structure with hierarchy layout. As usual the structure does only display its text as descriptions but I can enable the display the key in BEx Web by right-click on the analysis item --> Properties --> Characteristic --> Display. Unfortunately these setting can not be defined directly in the structure within the Query Designer.
    For a workaround I put the query into a web template, in which I used the Set Presentation (SET_PRESENTATION) command to enable key and text display from the start. Hence I put that command in the wem template parameters Action Before First Rendering (ACTION_BEFORE_FIRST_RENDERING). Everything is working properly and makes me very happy.
    But... there is one thing missing, I would like to implement... I want a toggle button, which allows the user to switch between key and text display and text display. Unfortunately setting the same command from Action Before First Rendering (ACTION_BEFORE_FIRST_RENDERING on a various button does not working. The button command only affects data rows of the leaves of the structure hierarchy. All parent nodes do not change their appearance.
    Any ideas how to solve this?
    Thank you for any helps and comments!
    Sebastian

    Hi Sebastian,
    I have a similar problem. Can you help me? How did you set the entry in Member Presentation of Command SET_PRESENTATION to display key and text? I just found the values to set the only text or only key.
    best regards,
    Barbara

  • [Solved]SSH messed command prompt

    Hello,
    I try to describe what is my problem. [CURSOR] - is my cursor
    I connect to SSH. OK
    I type command. OK
    I can correct beginning of command. OK
    I execute command. OK
    $  echo 11111111111111111111111111
    $  echo 0000000000000000000000000
    I go to history - first command shows OK
    $  echo 0000000000000000000000000
    second history command when I try correct beginning(click home button or left arrow), I simply can't, I can access only 11-th letter of command.
    $  echo 11111[CURSOR]111111111111111111111
    now I go back to first history command
    $  echo 11111echo 000000000000000000000000[CURSOR]
    command prompt stay messed,  and command can be executed successfuly only if I dont touch it.
    I can go to beggining, but only 11th character
    $  echo 11111[CURSOR]echo 000000000000000000000000
    I press once more arrow down to get "live" clear command prompt.
    $  echo 11111[CURSOR]
    prompt stay messed, I cant delete string, only ctrl+c helps.
    I tried urxvt and xterm. Generally it will happen If I execute command which has more than 30 letters.
    Thanks for help.
    Last edited by kubco2 (2013-11-18 20:31:39)

    $TERM says same: xterm
    local machine
    $ infocmp
    # Reconstructed via infocmp from file: /usr/share/terminfo/x/xterm
    xterm|xterm terminal emulator (X Window System),
    am, bce, km, mc5i, mir, msgr, npc, xenl,
    colors#8, cols#80, it#8, lines#24, pairs#64,
    acsc=``aaffggiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~,
    bel=^G, blink=\E[5m, bold=\E[1m, cbt=\E[Z, civis=\E[?25l,
    clear=\E[H\E[2J, cnorm=\E[?12l\E[?25h, cr=^M,
    csr=\E[%i%p1%d;%p2%dr, cub=\E[%p1%dD, cub1=^H,
    cud=\E[%p1%dB, cud1=^J, cuf=\E[%p1%dC, cuf1=\E[C,
    cup=\E[%i%p1%d;%p2%dH, cuu=\E[%p1%dA, cuu1=\E[A,
    cvvis=\E[?12;25h, dch=\E[%p1%dP, dch1=\E[P, dl=\E[%p1%dM,
    dl1=\E[M, ech=\E[%p1%dX, ed=\E[J, el=\E[K, el1=\E[1K,
    flash=\E[?5h$<100/>\E[?5l, home=\E[H, hpa=\E[%i%p1%dG,
    ht=^I, hts=\EH, ich=\E[%p1%d@, il=\E[%p1%dL, il1=\E[L,
    ind=^J, indn=\E[%p1%dS, invis=\E[8m,
    is2=\E[!p\E[?3;4l\E[4l\E>, kDC=\E[3;2~, kEND=\E[1;2F,
    kHOM=\E[1;2H, kIC=\E[2;2~, kLFT=\E[1;2D, kNXT=\E[6;2~,
    kPRV=\E[5;2~, kRIT=\E[1;2C, kb2=\EOE, kbs=^H, kcbt=\E[Z,
    kcub1=\EOD, kcud1=\EOB, kcuf1=\EOC, kcuu1=\EOA,
    kdch1=\E[3~, kend=\EOF, kent=\EOM, kf1=\EOP, kf10=\E[21~,
    kf11=\E[23~, kf12=\E[24~, kf13=\E[1;2P, kf14=\E[1;2Q,
    kf15=\E[1;2R, kf16=\E[1;2S, kf17=\E[15;2~, kf18=\E[17;2~,
    kf19=\E[18;2~, kf2=\EOQ, kf20=\E[19;2~, kf21=\E[20;2~,
    kf22=\E[21;2~, kf23=\E[23;2~, kf24=\E[24;2~,
    kf25=\E[1;5P, kf26=\E[1;5Q, kf27=\E[1;5R, kf28=\E[1;5S,
    kf29=\E[15;5~, kf3=\EOR, kf30=\E[17;5~, kf31=\E[18;5~,
    kf32=\E[19;5~, kf33=\E[20;5~, kf34=\E[21;5~,
    kf35=\E[23;5~, kf36=\E[24;5~, kf37=\E[1;6P, kf38=\E[1;6Q,
    kf39=\E[1;6R, kf4=\EOS, kf40=\E[1;6S, kf41=\E[15;6~,
    kf42=\E[17;6~, kf43=\E[18;6~, kf44=\E[19;6~,
    kf45=\E[20;6~, kf46=\E[21;6~, kf47=\E[23;6~,
    kf48=\E[24;6~, kf49=\E[1;3P, kf5=\E[15~, kf50=\E[1;3Q,
    kf51=\E[1;3R, kf52=\E[1;3S, kf53=\E[15;3~, kf54=\E[17;3~,
    kf55=\E[18;3~, kf56=\E[19;3~, kf57=\E[20;3~,
    kf58=\E[21;3~, kf59=\E[23;3~, kf6=\E[17~, kf60=\E[24;3~,
    kf61=\E[1;4P, kf62=\E[1;4Q, kf63=\E[1;4R, kf7=\E[18~,
    kf8=\E[19~, kf9=\E[20~, khome=\EOH, kich1=\E[2~,
    kind=\E[1;2B, kmous=\E[M, knp=\E[6~, kpp=\E[5~,
    kri=\E[1;2A, mc0=\E[i, mc4=\E[4i, mc5=\E[5i, meml=\El,
    memu=\Em, op=\E[39;49m, rc=\E8, rev=\E[7m, ri=\EM,
    rin=\E[%p1%dT, rmacs=\E(B, rmam=\E[?7l, rmcup=\E[?1049l,
    rmir=\E[4l, rmkx=\E[?1l\E>, rmm=\E[?1034l, rmso=\E[27m,
    rmul=\E[24m, rs1=\Ec, rs2=\E[!p\E[?3;4l\E[4l\E>, sc=\E7,
    setab=\E[4%p1%dm, setaf=\E[3%p1%dm,
    setb=\E[4%?%p1%{1}%=%t4%e%p1%{3}%=%t6%e%p1%{4}%=%t1%e%p1%{6}%=%t3%e%p1%d%;m,
    setf=\E[3%?%p1%{1}%=%t4%e%p1%{3}%=%t6%e%p1%{4}%=%t1%e%p1%{6}%=%t3%e%p1%d%;m,
    sgr=%?%p9%t\E(0%e\E(B%;\E[0%?%p6%t;1%;%?%p2%t;4%;%?%p1%p3%|%t;7%;%?%p4%t;5%;%?%p7%t;8%;m,
    sgr0=\E(B\E[m, smacs=\E(0, smam=\E[?7h, smcup=\E[?1049h,
    smir=\E[4h, smkx=\E[?1h\E=, smm=\E[?1034h, smso=\E[7m,
    smul=\E[4m, tbc=\E[3g, u6=\E[%i%d;%dR, u7=\E[6n,
    u8=\E[?1;2c, u9=\E[c, vpa=\E[%i%p1%dd,
    host machine
    $ infocmp
    # Reconstructed via infocmp from file: /lib/terminfo/x/xterm
    xterm|xterm-debian|X11 terminal emulator,
    am, bce, km, mc5i, mir, msgr, npc, xenl,
    colors#8, cols#80, it#8, lines#24, pairs#64,
    acsc=``aaffggiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~,
    bel=^G, blink=\E[5m, bold=\E[1m, cbt=\E[Z, civis=\E[?25l,
    clear=\E[H\E[2J, cnorm=\E[?12l\E[?25h, cr=^M,
    csr=\E[%i%p1%d;%p2%dr, cub=\E[%p1%dD, cub1=^H,
    cud=\E[%p1%dB, cud1=^J, cuf=\E[%p1%dC, cuf1=\E[C,
    cup=\E[%i%p1%d;%p2%dH, cuu=\E[%p1%dA, cuu1=\E[A,
    cvvis=\E[?12;25h, dch=\E[%p1%dP, dch1=\E[P, dl=\E[%p1%dM,
    dl1=\E[M, ech=\E[%p1%dX, ed=\E[J, el=\E[K, el1=\E[1K,
    flash=\E[?5h$<100/>\E[?5l, home=\E[H, hpa=\E[%i%p1%dG,
    ht=^I, hts=\EH, ich=\E[%p1%d@, il=\E[%p1%dL, il1=\E[L,
    ind=^J, indn=\E[%p1%dS, invis=\E[8m,
    is2=\E[!p\E[?3;4l\E[4l\E>, kDC=\E[3;2~, kEND=\E[1;2F,
    kHOM=\E[1;2H, kIC=\E[2;2~, kLFT=\E[1;2D, kNXT=\E[6;2~,
    kPRV=\E[5;2~, kRIT=\E[1;2C, kb2=\EOE, kbs=\177, kcbt=\E[Z,
    kcub1=\EOD, kcud1=\EOB, kcuf1=\EOC, kcuu1=\EOA,
    kdch1=\E[3~, kend=\EOF, kent=\EOM, kf1=\EOP, kf10=\E[21~,
    kf11=\E[23~, kf12=\E[24~, kf13=\E[1;2P, kf14=\E[1;2Q,
    kf15=\E[1;2R, kf16=\E[1;2S, kf17=\E[15;2~, kf18=\E[17;2~,
    kf19=\E[18;2~, kf2=\EOQ, kf20=\E[19;2~, kf21=\E[20;2~,
    kf22=\E[21;2~, kf23=\E[23;2~, kf24=\E[24;2~,
    kf25=\E[1;5P, kf26=\E[1;5Q, kf27=\E[1;5R, kf28=\E[1;5S,
    kf29=\E[15;5~, kf3=\EOR, kf30=\E[17;5~, kf31=\E[18;5~,
    kf32=\E[19;5~, kf33=\E[20;5~, kf34=\E[21;5~,
    kf35=\E[23;5~, kf36=\E[24;5~, kf37=\E[1;6P, kf38=\E[1;6Q,
    kf39=\E[1;6R, kf4=\EOS, kf40=\E[1;6S, kf41=\E[15;6~,
    kf42=\E[17;6~, kf43=\E[18;6~, kf44=\E[19;6~,
    kf45=\E[20;6~, kf46=\E[21;6~, kf47=\E[23;6~,
    kf48=\E[24;6~, kf49=\E[1;3P, kf5=\E[15~, kf50=\E[1;3Q,
    kf51=\E[1;3R, kf52=\E[1;3S, kf53=\E[15;3~, kf54=\E[17;3~,
    kf55=\E[18;3~, kf56=\E[19;3~, kf57=\E[20;3~,
    kf58=\E[21;3~, kf59=\E[23;3~, kf6=\E[17~, kf60=\E[24;3~,
    kf61=\E[1;4P, kf62=\E[1;4Q, kf63=\E[1;4R, kf7=\E[18~,
    kf8=\E[19~, kf9=\E[20~, khome=\EOH, kich1=\E[2~,
    kind=\E[1;2B, kmous=\E[M, knp=\E[6~, kpp=\E[5~,
    kri=\E[1;2A, mc0=\E[i, mc4=\E[4i, mc5=\E[5i, meml=\El,
    memu=\Em, op=\E[39;49m, rc=\E8, rev=\E[7m, ri=\EM,
    rin=\E[%p1%dT, rmacs=\E(B, rmam=\E[?7l, rmcup=\E[?1049l,
    rmir=\E[4l, rmkx=\E[?1l\E>, rmso=\E[27m, rmul=\E[24m,
    rs1=\Ec, rs2=\E[!p\E[?3;4l\E[4l\E>, sc=\E7,
    setab=\E[4%p1%dm, setaf=\E[3%p1%dm,
    setb=\E[4%?%p1%{1}%=%t4%e%p1%{3}%=%t6%e%p1%{4}%=%t1%e%p1%{6}%=%t3%e%p1%d%;m,
    setf=\E[3%?%p1%{1}%=%t4%e%p1%{3}%=%t6%e%p1%{4}%=%t1%e%p1%{6}%=%t3%e%p1%d%;m,
    sgr=%?%p9%t\E(0%e\E(B%;\E[0%?%p6%t;1%;%?%p2%t;4%;%?%p1%p3%|%t;7%;%?%p4%t;5%;%?%p7%t;8%;m,
    sgr0=\E(B\E[m, smacs=\E(0, smam=\E[?7h, smcup=\E[?1049h,
    smir=\E[4h, smkx=\E[?1h\E=, smso=\E[7m, smul=\E[4m,
    tbc=\E[3g, u6=\E[%i%d;%dR, u7=\E[6n, u8=\E[?1;2c, u9=\E[c,
    vpa=\E[%i%p1%dd,
    I dont know, what should I find in infocmp.
    Last edited by kubco2 (2013-11-18 17:36:08)

  • How to creating file with APD (tcode rsanwb) with Key and Test characterist

    Hi everybody!
    I'm creating an APD with RSANBW. Data Source is a query and Data Target a File. I want display Key and Test for everyone of query characteristics. I've revised properties of characteristics into the query rows and check "key and test", however the file only contains key values.
    Some help will be very appreciated,
    Regards,
    Sebastian.

    Hi Sebastian
    the data  the query pulls is from the cube/DSO, which stores only the key.
    the query pulls the text from the master data tables for diplay purpose only. For APD purpose the query only supplies what is avaialable in the infoprovider.
    To have key and text in the target file you neeed to use transformation type routine in the APD or create an infoprovider that stores both text and key as separate fields in it and use that for the APD, with or without a query.
    Good luck,
    vijay

  • How can i remove a key and its value from properties file

    hi all,
    i want remove a particular key and associated value from the
    properties file. is their any standard way of doing?
    thanks inadvance
    daya

    hi,
    thanks
    i am able to remove the key,
    one more question how can avoid storing date and time
    in properties file.
    thanks
    daya

  • Reading newly opened command prompt output

    I need to use SSH to connect to a server. Rather than downloading a third party SSH API, I would like to use Putty which is already on my computer. The problem is that when using Putty from the command line to connect to a server it opens the connection in a completely different command prompt window instead of the original window. How would I read the output from the new window? I believe this code would have worked if it opened the connection in the same command prompt window...
    try{
    File test = new File("c:\\program files\\putty");
    Runtime rt = Runtime.getRuntime();
    Process output = rt.exec("cmd /c putty.exe -ssh username@host", null, test);
    BufferedReader br = new BufferedReader (new InputStreamReader(output.getInputStream()));
    String line = null;
    while((line = br.readLine()) != null )
    { System.out.println(line); } // display process output
    int exitVal = output.waitFor(); // get process exit value
    System.out.println("Process Exit Value : "+ exitVal);
    catch(IOException ioe){
    System.err.println(ioe);
    catch (Throwable t) {
    t.printStackTrace();
    }

    web definition of 'come unstuck' :
    come unstuck (British & Australian)
    if a person or something they are trying to achieve comes unstuck, they have problems which cause them to fail. Athletes who don't prepare properly for the humid conditions will certainly come unstuck. The negotiations came unstuck over disagreements about the wording.

  • How do i get a output in CSV of a SQL query executed via SQL Command prompt

    Hi All,
    I have a question with reference to SQL command prompt. I have a sql query which runs properly and gives proper execution in SQL Management console in GUI.
    This report is used to pull the free disk space report of our servers
    As i want to schedule it as a report so i want to script it to run via SQL command prompt. I made the script and it works fine if i enter it in SQL command prompt. When i try to extract the output to a CSV File it fails. Below is the details of the command
    i am using to query to pull the data. Can anyone help me in getting the output of this query in SQL command prompt.
    sqlcmd -W -s , -S Servers FQDN
    use operationsmanager
    Go
    Query:"select Path, InstanceName, SampleValue 
    from PerformanceDataAllView pdv with (NOLOCK)
    inner join PerformanceCounterView pcv on pdv.performancesourceinternalid = pcv.performancesourceinternalid
    inner join BaseManagedEntity bme on pcv.ManagedEntityId = bme.BaseManagedEntityId
    where SampleValue < '20' and CounterName='% Free Space' and TimeSampled > '2014-08-06 11:00:00.00'
    order by countername, timesampled" -s "," -o "C:\DataSqlCmd.csv"
    Go
    When i enter the command without the quotes when the query is starting and ending and also without the output command (-s "," -o "C:\DataSqlCmd.csv") it is working and shows the output in the command prompt. Below is the screen shot for
    your reference.
    Due to security reasons i have to erase the server names:
    But when i add the line to extract the output ( -s "," -o "C:\DataSqlCmd.csv") It gives me this error:
    The exact command would be:
    sqlcmd -W -s , -S CINMLVSCOM01.e2klab.ge.com
    use operationsmanager
    Go
    "select Path, InstanceName, SampleValue 
    from PerformanceDataAllView pdv with (NOLOCK)
    inner join PerformanceCounterView pcv on pdv.performancesourceinternalid = pcv.performancesourceinternalid
    inner join BaseManagedEntity bme on pcv.ManagedEntityId = bme.BaseManagedEntityId
    where SampleValue < '20' and CounterName='% Free Space' and TimeSampled > '2014-08-06 11:00:00.00'
    order by countername, timesampled" -s "," -o "C:\DataSqlCmd.csv" -h-1
    Go
    saying the syntax is not correct or some thing as per the below screenshot.
    Can any one please help. Below is just the query whi i use to get the output in SQL management studio.
    Can any one make a command for the below quer so i can directly execute and test for getting the output.
    select Path, InstanceName, SampleValue 
    from PerformanceDataAllView pdv with (NOLOCK)
    inner join PerformanceCounterView pcv on pdv.performancesourceinternalid = pcv.performancesourceinternalid
    inner join BaseManagedEntity bme on pcv.ManagedEntityId = bme.BaseManagedEntityId
    where SampleValue < '20' and CounterName='% Free Space' and TimeSampled > '2014-08-06 11:00:00.00'
    order by countername, timesampled
    Gautam.75801

    Can you try the below query?
    select Path, InstanceName, SampleValue
    from PerformanceDataAllView pdv with (NOLOCK)
    inner join PerformanceCounterView pcv on pdv.performancesourceinternalid = pcv.performancesourceinternalid
    inner join BaseManagedEntity bme on pcv.ManagedEntityId = bme.BaseManagedEntityId
    where SampleValue < 20 and CounterName like '% Free Space' and TimeSampled > '2014-08-06 11:00:00.00'
    order by countername, timesampled
    -- replace the below query part in the below SQLCMD C:\>SQLCMD -S SERVERNAME -E -d operationsmanager -Q "select * from sys.databases ds with (nolock) where name='master'" -s "," -o "F:\PowerSQL\MyData.csv" -h -1
    SQLCMD -S SERVERNAME -E -d OperationsManager -Q "select Path, InstanceName, SampleValue
    from PerformanceDataAllView pdv with (NOLOCK)
    inner join PerformanceCounterView pcv on pdv.performancesourceinternalid = pcv.performancesourceinternalid
    inner join BaseManagedEntity bme on pcv.ManagedEntityId = bme.BaseManagedEntityId
    where SampleValue < '20' and CounterName='% Free Space' and TimeSampled > '2014-08-06 11:00:00.00'
    order by countername, timesampled" -s "," -o "c:\MyData.csv" -h -1
    Refer for the other ways 
    http://dba.stackexchange.com/questions/23566/writing-select-result-to-a-csv-file
    --Prashanth

  • How to pause output in command prompt

    I have 10 sentence for instance, i want to display one sentence each time i press enter. Does anyone know how to do it in java?(command prompt)

    1. Wrap the default System.err and System.out in your own PrintStreams
    2. Replace them with your wrapper classes (see System.setErr(PrintStream) etc)
    3. In the wrapper classes, parse output looking for '\n' chars + any time you find one, write to that point, then read a return from System.in

  • Cmd command unrecognized in windows 8 command prompt

    I'm trying to create a txt file via command line on windows 8 using the following command in the root directory (C:):
    echo getmac for laptop > c:\data\laptop_mac.txt"
    cmd /c "getmac >> c:\data\laptop_mac.txt"
    The fist line works but the command prompt tells me following with the cmd command: 'cmd' is not recognized as an internal or external command, operable program or batch file.
    As a result the file does get created but it doesn't get my mac address like it should. I should point out that the exact same commands works under windows 7 enterprise. I used the sfc/scannow command to check for corrupt files and it did find some files.
    I would attach the log if I knew how to attach one. The file is very long and I don't want to post it directly in here because of that.
    Also, I did run this in administrator and windows 8 is updated. Finally, I noticed that the cmd command works in the system32 folder but I really don't think I should create a txt file there.

    The reason I have 3 quotation marks is because that's what my instructor wrote. What confuses the living heck out of me is the fact that the exact same command with the quotation marks works just fine in windows 7 enterprise. I'm having a hard time understand
    why it doesn't work in windows 8.
    We have seen discrepancies involving Enterprise versions before.  See if the cmd help could explain them:
    cmd  /?
    <extract  OS="W8.1 Pro">
    If /C or /K is specified, then the remainder of the command line after
    the switch is processed as a command line, where the following logic is
    used to process quote (") characters:
        1.  If all of the following conditions are met, then quote characters
            on the command line are preserved:
            - no /S switch
            - exactly two quote characters
            - no special characters between the two quote characters,
              where special is one of: &<>()@^|
            - there are one or more whitespace characters between the
              two quote characters
            - the string between the two quote characters is the name
              of an executable file.
        2.  Otherwise, old behavior is to see if the first character is
            a quote character and if so, strip the leading character and
            remove the last quote character on the command line, preserving
            any text after the last quote character.
    </extract>
    I guess that might cover my escaped double-quote requirement?
    Btw I tried:
    cmd /c getmac >> pcmac.txt
    and it failed.
    What was the symptom exactly and where were you when you tried this (directory-wise)?  E.g. Now I'm wondering where that cmd.exe would be running (therefore writing).  If it is at the root or somewhere else protected you might be seeing a permissions
    problem that way.  I would try running ProcMon to check on that possibility, as well as clarify exactly what that cmd.exe is doing.
    Good luck
    Robert
    Robert Aldwinckle

Maybe you are looking for

  • Ipad clock app ios7 accidentally deleted

    I deleted my clock app on my ipad mini using ios 7.1,  Can anyone advise me how I can restore it to my home screen.  The only way I can open it at the moment is through siri.  Thanks

  • Mac Mini and Bluetooth

    Is there any other way that I can use the Bluetooth Module with out buying the complete AirPort Extream/Bluetooth Kit and without using the Bluetooth Dongle? Mac Mini 1.42 MHZ Combo Drive   Mac OS X (10.3.9)   512 MB DDR 80 GB HD

  • User exit for item level in PO

    Hi: Once we create a PO based on PR. I should not be able to change the net price. I need to through a ERROR MESSAGE. The price of PR and PO Shuold be same. Used should not change the net price, If he tries to change it, A error msg should be thrown.

  • Itunes is saying device not known

    My kids got i pod touch's for christmas. One I can sync on itunes, the other 2 I can't. It says to restore but when I try to do this it says device not known Ani ideas, thank you

  • How to attach text documents?

    I already learned that I can paste PDF file in an iWebsite. Problem is that this is indeed a 'paste' where the text fully appears on the screen. Does anybody know whether I can attach text files (like iWork, Word or PDF)?