Click here to Skip to main content
14,600,694 members

Visual Basic

 
QuestionProblem with custom control stealing focus: Resolved 'sort of' Pin
speedbump9930-Mar-18 8:02
Memberspeedbump9930-Mar-18 8:02 
AnswerRe: Problem with custom control stealing focus: Resolved 'sort of' Pin
Gerry Schmitz31-Mar-18 7:10
mveGerry Schmitz31-Mar-18 7:10 
QuestionAddition and Subtraction Operation in SQL update query Pin
Member 1375497530-Mar-18 4:50
MemberMember 1375497530-Mar-18 4:50 
QuestionRe: Addition and Subtraction Operation in SQL update query Pin
Eddy Vluggen30-Mar-18 5:23
professionalEddy Vluggen30-Mar-18 5:23 
AnswerRe: Addition and Subtraction Operation in SQL update query Pin
Richard Deeming3-Apr-18 8:30
mveRichard Deeming3-Apr-18 8:30 
Questionproblem with opening a text file in my app with double click Pin
Sh3R3iF29-Mar-18 9:22
MemberSh3R3iF29-Mar-18 9:22 
QuestionRe: problem with opening a text file in my app with double click Pin
Richard MacCutchan29-Mar-18 22:19
mveRichard MacCutchan29-Mar-18 22:19 
QuestionProblem running a command when the path has spaces in its name. Pin
David Mujica27-Mar-18 9:37
MemberDavid Mujica27-Mar-18 9:37 
Backgroud: I'm trying to automate the printing of PDF files.

I found that by invoking
acrord32.exe /N /T pdfFile printerName
on the command line you can print PDFs silently. Great.

I'm trying to automate this in VB via
Dim p As Process = New Process()
Dim pi As ProcessStartInfo = New ProcessStartInfo()
Dim command As String = Chr(34) & "C:\Program Files (x86)\Adobe\Reader 11.0\Reader\acrord32.exe" & Chr(34) & " /N /T "

        Try

            pi.Arguments = String.Format("{0} {1} {2} {3}{4}{5}", " /C ", command, sFilename, Chr(34), sPrinter, Chr(34))

            pi.UseShellExecute = False
            pi.RedirectStandardError = True
            pi.RedirectStandardOutput = True
            pi.CreateNoWindow = True

            pi.WindowStyle = ProcessWindowStyle.Normal

            pi.FileName = "cmd.exe"
            p.StartInfo = pi

            p.Start()

            Do Until p.HasExited : Loop

            outp = p.StandardOutput.ReadToEnd

            Debug.Print(outp)

            outp = p.StandardError.ReadToEnd

            Debug.Print(outp)

        Catch ex As Exception
            Debug.Print(ex.Message)

        End Try


The error message I get from StdErr is
Quote:
'C:\Program' is not recognized as an internal or external command, operable program or batch file.


I've tried putting quotes around the command string, but it just doesn't work.

Turning to the community for guidance. Java | [Coffee]
AnswerRe: Problem running a command when the path has spaces in its name. Pin
Dave Kreskowiak27-Mar-18 10:30
mveDave Kreskowiak27-Mar-18 10:30 
GeneralRe: Problem running a command when the path has spaces in its name. Pin
David Mujica28-Mar-18 9:35
MemberDavid Mujica28-Mar-18 9:35 
QuestionConversion Blues Pin
Member 1274920627-Mar-18 5:00
MemberMember 1274920627-Mar-18 5:00 
AnswerRe: Conversion Blues Pin
Richard Deeming27-Mar-18 5:20
mveRichard Deeming27-Mar-18 5:20 
AnswerRe: Conversion Blues Pin
Richard MacCutchan27-Mar-18 5:21
mveRichard MacCutchan27-Mar-18 5:21 
QuestionHow to add custom control to designer like tooltip Pin
speedbump9927-Mar-18 2:30
Memberspeedbump9927-Mar-18 2:30 
AnswerRe: How to add custom control to designer like tooltip Pin
Dave Kreskowiak27-Mar-18 5:08
mveDave Kreskowiak27-Mar-18 5:08 
GeneralRe: How to add custom control to designer like tooltip Pin
speedbump9927-Mar-18 5:15
Memberspeedbump9927-Mar-18 5:15 
QuestionHow do I link two forms together in VB 2010? Pin
Lost25-Mar-18 3:36
MemberLost25-Mar-18 3:36 
AnswerRe: How do I link two forms together in VB 2010? Pin
Eddy Vluggen25-Mar-18 19:18
professionalEddy Vluggen25-Mar-18 19:18 
Questionentity framework How to remove some items from local entities Pin
desanti23-Mar-18 8:59
Memberdesanti23-Mar-18 8:59 
QuestionRe: entity framework How to remove some items from local entities Pin
Eddy Vluggen24-Mar-18 13:39
professionalEddy Vluggen24-Mar-18 13:39 
QuestionCould someone help me with a Database question? Pin
D. Doulas22-Mar-18 12:01
MemberD. Doulas22-Mar-18 12:01 
AnswerRe: Could someone help me with a Database question? Pin
Richard MacCutchan22-Mar-18 23:55
mveRichard MacCutchan22-Mar-18 23:55 
GeneralRe: Could someone help me with a Database question? Pin
D. Doulas24-Mar-18 8:23
MemberD. Doulas24-Mar-18 8:23 
GeneralRe: Could someone help me with a Database question? Pin
Richard MacCutchan24-Mar-18 21:11
mveRichard MacCutchan24-Mar-18 21:11 
GeneralRe: Could someone help me with a Database question? Pin
D. Doulas1-Apr-18 10:20
MemberD. Doulas1-Apr-18 10:20 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.