xp_cmdshell help

  • Hi,

    according to BOL i cannot use more then on set of double quotation marks.

    is there any workaround for me to still use 2 set of double quotation marks and i cannot use the FAT 8.3 file name?

    THX

  • What do you mean? If there's 1 space anywhere in the path youhave to put everything in quotation :

    "C:\whatever space\file space .txt"

    What command are you trying to pass and what's the error message?

  • yes i have to call the EXE file with the quotation marks in it and the parameters needs to have quotation marks too.

  • Should not be an issue... again what have you triedand what's the error?

  • {edit} Never mind... misread the post.

    --Jeff Moden


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.

    Change is inevitable... Change for the better is not.


    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)

  • Ninja's_RGR'us (7/31/2011)


    Should not be an issue... again what have you triedand what's the error?

    simple script that not working when i have 2 sets of quotation marks

    EXEC master..xp_cmdshell '"C:\FOLDER A\xcopy.exe" "C:\test 1\test.txt" f:\'

  • And the error is?

  • 'C:\FOLDER' is not recognized as an internal or external command,

    operable program or batch file.

    NULL

    and if i take the command "C:\FOLDER A\xcopy.exe" "C:\test 1\test.txt" f:\

    and run it in cmd it's work good.

  • a quick fix would be to put the xcopy.exe in a folder that exists int he cmd lines PATH variable...then, since you do not need to specify the path fro xcopy, you can use your dblquotes for the filenames.

    EXEC master..xp_cmdshell 'xcopy.exe "C:\test 1\test.txt" f:\'

    Lowell


    --help us help you! If you post a question, make sure you include a CREATE TABLE... statement and INSERT INTO... statement into that table to give the volunteers here representative data. with your description of the problem, we can provide a tested, verifiable solution to your question! asking the question the right way gets you a tested answer the fastest way possible!

  • This works fine for me.

    exec xp_cmdshell 'COPY "\\fordiavcenter41\backup\*REPORTSERVER*.bak" "Q:\Backups SQL"'

  • i only give you an example of when you call the EXE file that have space in it you must include the "" in the syntax,

    and when i need to use the "" again in the same syntax it's not working.

    you should try my little example to see the error.

  • Mad-Dog (8/1/2011)


    i only give you an example of when you call the EXE file that have space in it you must include the "" in the syntax,

    and when i need to use the "" again in the same syntax it's not working.

    you should try my little example to see the error.

    Why bother? You should try MY exemple and Lowell's which actually work.

    If you're still having issues then we need to see the real command you're running.

Viewing 12 posts - 1 through 11 (of 11 total)

You must be logged in to reply to this topic. Login to reply