Results 1 to 3 of 3

Thread: xp_cmdshell

  1. #1
    Join Date
    Apr 2003
    Posts
    5

    Unanswered: xp_cmdshell

    I am trying to print a text file "C:\temp.txt" from Query Analyzer
    using the following code

    Use Master
    EXEC xp_cmdshell "print c:\temp.txt", NO_OUTPUT

    When i executed it is not printing the text file

    There is a default printer on the machine SQL server is running .

    can somebody help me out

  2. #2
    Join Date
    Oct 2001
    Location
    England
    Posts
    426
    Try opening a command window and running
    print c:\temp.txt
    That's what xp_cmdshell will do.

    You will need a printer that has dos drivers and a type command redirected to the printer to do it this way.

  3. #3
    Join Date
    Aug 2002
    Location
    Scotland
    Posts
    1,578
    True, NO_OUTPUT - Is an optional parameter executing the given command_string, and does not return any output to the client.
    --Satya SKJ
    Microsoft SQL Server MVP
    [IMG]http://sqlserver-qa.net/google_bart.gif[/IMG]

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •