Jump to content
Sign in to follow this  

quotes in command ?

Recommended Posts

im trying to run the following command By RunWait and there is quotes in the command I do not know how to process...

please help

this is what I need piped to the command line...

sqlcmd -S KITCHENSQLEXPRESSSQLuser -P SQLpassword -Q "BACKUP DATABASE testDatabase TO DISK='C:tempBackupsql.bak'"

I have this...

$server = "Kitchen\SQLEXPRESS
$user = "SQLuser
$password = "SQLPassword"

_RunWait "sqlcmd -S "&"  -U "&"$user"&" -P "&"$password   "

im getting lost where there is a quote in the original command that needs to be passed to the command line

Share this post

Link to post
Share on other sites

Try this:

$server = "Kitchen\SQLEXPRESS"
$user = "SQLuser"
$password = "SQLPassword"

$command = "sqlcmd -S " & $server & $user & " -P " & $password & ' -Q "BACKUP DATABASE testDatabase TO DISK=' & "'C:\temp\Backupsql.bak'" & '"'


Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Create New...