Hallöchen an alle, ich habe ein Problem mit den Parametern zu der pg_dump.exe, der Befehl Sieht so aus der dann in der cmd ausgeführt wird:
C:\Program Files\PostgreSQL\12\bin\pg_dump.exe --file "C:\Backup\Sicherung.backup" --host "localhost" --port "5432" --username "postgres" --no-password --verbose --role "postgres" --format=c --blobs --section=pre-data --section=data --section=post-data --encoding "UTF8" "postgres"
Wie kann ich den Befehl ausführen ? und wie bekomme ich die Ausgabe der CMD in meine Richtextbox ?
Kann mir jemand dabei helfen ?
PostgreSQL Backup
Forum rules
Do not post any licensing information in this forum.
Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
Do not post any licensing information in this forum.
Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
Re: PostgreSQL Backup
- $pgcmd = 'C:\Program Files\PostgreSQL\12\bin\pg_dump.exe --file C:\Backup\Sicherung.backup --host localhost --port 5432 --username postgres --no-password --verbose --role postgres --format=c --blobs --section=pre-data --section=data --section=post-data --encoding UTF8 postgres'
- $output = Invoke-Expression $cmd
- stefanwue1968
- Posts: 3
- Last visit: Tue Feb 07, 2023 3:24 pm
Re: PostgreSQL Backup
Danke für die Antwort, leider funktioniert es so nicht.
Invoke-Expression : Das Argument kann nicht an den Parameter "Command" gebunden werden, da es NULL ist.
In C:\a\post.ps1:77 Zeichen:34
+ $output = Invoke-Expression $cmd <<<< Fehler
+ ~~~~
+ CategoryInfo : InvalidData: (:) [Invoke-Expression], ParameterBindingValidationException
+ FullyQualifiedErrorId : ParameterArgumentValidationErrorNullNotAllowed,Microsoft.PowerShell.Commands.InvokeExpre
ssionCommand
was habe ich falsch gemacht ? wie rufe ich den Befehl richtig auf ?
Invoke-Expression : Das Argument kann nicht an den Parameter "Command" gebunden werden, da es NULL ist.
In C:\a\post.ps1:77 Zeichen:34
+ $output = Invoke-Expression $cmd <<<< Fehler
+ ~~~~
+ CategoryInfo : InvalidData: (:) [Invoke-Expression], ParameterBindingValidationException
+ FullyQualifiedErrorId : ParameterArgumentValidationErrorNullNotAllowed,Microsoft.PowerShell.Commands.InvokeExpre
ssionCommand
was habe ich falsch gemacht ? wie rufe ich den Befehl richtig auf ?
Re: PostgreSQL Backup
Sorry:
$output = Invoke-Expression $pgcmd
I recommend learning PowerShell before trying to write scripts. Your questions are answered in almost all books in the first or second chapter.
$output = Invoke-Expression $pgcmd
I recommend learning PowerShell before trying to write scripts. Your questions are answered in almost all books in the first or second chapter.
- Alexander Riedel
- Posts: 8488
- Last visit: Tue Apr 16, 2024 8:42 am
- Been upvoted: 37 times
Re: PostgreSQL Backup
I have to also point out that you will get more answers here if you post in English. You know, this being a U.S. based forum and all
Alexander Riedel
SAPIEN Technologies, Inc.
SAPIEN Technologies, Inc.