Start a process with a parameter in the file name?

M

mcterborg

Hello everyone, here is what I want to do. I have a ATI video card
and it allows me to setup profiles for monitor configurations and so
forth. The shortcut to activate one of these profiles looks like
this:

"C:\Program Files\ATI Technologies\ATI.ACE\CLI.exe" Load
profilename="Just Monitor"

Here is one example of how I've tried to do it:

returnMonitor.StartInfo.FileName = "C:\Program Files\ATI
Technologies\ATI.ACE\CLI.exe Load profilename=''Just Monitor''"

returnMonitor.Start()

No matter which way I code it, such as changing the apostrophes I get
this error message. I've tried using the StartInfo.Verb, but I have
no idea if that is what I'm supposed to do.

************** Exception Text **************
System.ComponentModel.Win32Exception: The system cannot find the file
specified
at
System.Diagnostics.Process.StartWithShellExecuteEx(ProcessStartInfo
startInfo)
at System.Diagnostics.Process.Start()
at StartBeyondTVwithDelay.Form1.Timer1_Tick(Object sender,
EventArgs e) in C:\Documents and Settings\Mark\My Documents\Visual
Studio Projects\StartBeyondTVwithDelay\Form1.vb:line 104
at System.Windows.Forms.Timer.OnTick(EventArgs e)
at System.Windows.Forms.Timer.DebuggableCallback(IntPtr hWnd, Int32
msg, IntPtr idEvent, IntPtr dwTime)


************** Loaded Assemblies **************
mscorlib
Assembly Version: 1.0.5000.0
Win32 Version: 1.1.4322.2032
CodeBase: file:///c:/windows/microsoft.net/framework/v1.1.4322/mscorlib.dll
----------------------------------------
StartBeyondTVwithDelay
Assembly Version: 1.0.2658.15650
Win32 Version: 1.0.2658.15650
CodeBase:
file:///C:/Documents%20and%20Settings/Mark/My%20Documents/Visual%20Studio%20Projects/StartBeyondTVwithDelay/bin/StartBeyondTVwithDelay.exe
----------------------------------------
System.Windows.Forms
Assembly Version: 1.0.5000.0
Win32 Version: 1.1.4322.2032
CodeBase: file:///c:/windows/assembly/gac/system.windows.forms/1.0.5000.0__b77a5c561934e089/system.windows.forms.dll
----------------------------------------
System
Assembly Version: 1.0.5000.0
Win32 Version: 1.1.4322.2032
CodeBase: file:///c:/windows/assembly/gac/system/1.0.5000.0__b77a5c561934e089/system.dll
----------------------------------------
System.Drawing
Assembly Version: 1.0.5000.0
Win32 Version: 1.1.4322.2032
CodeBase: file:///c:/windows/assembly/gac/system.drawing/1.0.5000.0__b03f5f7f11d50a3a/system.drawing.dll
----------------------------------------
Microsoft.VisualBasic
Assembly Version: 7.0.5000.0
Win32 Version: 7.10.6001.4
CodeBase: file:///c:/windows/assembly/gac/microsoft.visualbasic/7.0.5000.0__b03f5f7f11d50a3a/microsoft.visualbasic.dll
----------------------------------------
System.Xml
Assembly Version: 1.0.5000.0
Win32 Version: 1.1.4322.2032
CodeBase: file:///c:/windows/assembly/gac/system.xml/1.0.5000.0__b77a5c561934e089/system.xml.dll
----------------------------------------

************** JIT Debugging **************
To enable just in time (JIT) debugging, the config file for this
application or machine (machine.config) must have the
jitDebugging value set in the system.windows.forms section.
The application must also be compiled with debugging
enabled.

For example:

<configuration>
<system.windows.forms jitDebugging="true" />
</configuration>

When JIT debugging is enabled, any unhandled exception
will be sent to the JIT debugger registered on the machine
rather than being handled by this dialog.



Thanks in advance for your help!!!
Mark
 
G

Guest

Mark,

StartInfo's FileName property is for the name of the exe to start.
StartInfo's Argument property is for the command line arguments.

Kerry Moorman
 
Z

zacks

Hello everyone, here is what I want to do. I have a ATI video card
and it allows me to setup profiles for monitor configurations and so
forth. The shortcut to activate one of these profiles looks like
this:

"C:\Program Files\ATI Technologies\ATI.ACE\CLI.exe" Load
profilename="Just Monitor"

Here is one example of how I've tried to do it:

returnMonitor.StartInfo.FileName = "C:\Program Files\ATI
Technologies\ATI.ACE\CLI.exe Load profilename=''Just Monitor''"

returnMonitor.Start()

No matter which way I code it, such as changing the apostrophes I get
this error message. I've tried using the StartInfo.Verb, but I have
no idea if that is what I'm supposed to do.

You are using doubled up SINGLE quotes around the parameter Just
Monitor. You need to use doubled up DOUBLE quotes. As in:

returnMonitor.StartInfo.FileName = "C:\Program Files\ATI
Technologies\ATI.ACE\CLI.exe Load profilename=""Just Monitor"""
 
M

mcterborg

Hello everyone, here is what I want to do. I have a ATI video card
and it allows me to setup profiles for monitor configurations and so
forth. The shortcut to activate one of these profiles looks like
this:

"C:\Program Files\ATI Technologies\ATI.ACE\CLI.exe" Load
profilename="Just Monitor"

Here is one example of how I've tried to do it:

returnMonitor.StartInfo.FileName = "C:\Program Files\ATI
Technologies\ATI.ACE\CLI.exe Load profilename=''Just Monitor''"

returnMonitor.Start()

No matter which way I code it, such as changing the apostrophes I get
this error message. I've tried using the StartInfo.Verb, but I have
no idea if that is what I'm supposed to do.

************** Exception Text **************
System.ComponentModel.Win32Exception: The system cannot find the file
specified
at
System.Diagnostics.Process.StartWithShellExecuteEx(ProcessStartInfo
startInfo)
at System.Diagnostics.Process.Start()
at StartBeyondTVwithDelay.Form1.Timer1_Tick(Object sender,
EventArgs e) in C:\Documents and Settings\Mark\My Documents\Visual
Studio Projects\StartBeyondTVwithDelay\Form1.vb:line 104
at System.Windows.Forms.Timer.OnTick(EventArgs e)
at System.Windows.Forms.Timer.DebuggableCallback(IntPtr hWnd, Int32
msg, IntPtr idEvent, IntPtr dwTime)

************** Loaded Assemblies **************
mscorlib
Assembly Version: 1.0.5000.0
Win32 Version: 1.1.4322.2032
CodeBase: file:///c:/windows/microsoft.net/framework/v1.1.4322/mscorlib.dll
----------------------------------------
StartBeyondTVwithDelay
Assembly Version: 1.0.2658.15650
Win32 Version: 1.0.2658.15650
CodeBase:
file:///C:/Documents%20and%20Settings/Mark/My%20Documents/Visual%20Studio%20Projects/StartBeyondTVwithDelay/bin/StartBeyondTVwithDelay.exe
----------------------------------------
System.Windows.Forms
Assembly Version: 1.0.5000.0
Win32 Version: 1.1.4322.2032
CodeBase: file:///c:/windows/assembly/gac/system.windows.forms/1.0.5000.0__b77a5c561934e089/system.windows.forms.dll
----------------------------------------
System
Assembly Version: 1.0.5000.0
Win32 Version: 1.1.4322.2032
CodeBase: file:///c:/windows/assembly/gac/system/1.0.5000.0__b77a5c561934e089/system.dll
----------------------------------------
System.Drawing
Assembly Version: 1.0.5000.0
Win32 Version: 1.1.4322.2032
CodeBase: file:///c:/windows/assembly/gac/system.drawing/1.0.5000.0__b03f5f7f11d50a3a/system.drawing.dll
----------------------------------------
Microsoft.VisualBasic
Assembly Version: 7.0.5000.0
Win32 Version: 7.10.6001.4
CodeBase: file:///c:/windows/assembly/gac/microsoft.visualbasic/7.0.5000.0__b03f5f7f11d50a3a/microsoft.visualbasic.dll
----------------------------------------
System.Xml
Assembly Version: 1.0.5000.0
Win32 Version: 1.1.4322.2032
CodeBase: file:///c:/windows/assembly/gac/system.xml/1.0.5000.0__b77a5c561934e089/system.xml.dll
----------------------------------------

************** JIT Debugging **************
To enable just in time (JIT) debugging, the config file for this
application or machine (machine.config) must have the
jitDebugging value set in the system.windows.forms section.
The application must also be compiled with debugging
enabled.

For example:

<configuration>
<system.windows.forms jitDebugging="true" />
</configuration>

When JIT debugging is enabled, any unhandled exception
will be sent to the JIT debugger registered on the machine
rather than being handled by this dialog.

Thanks in advance for your help!!!
Mark

Never mind. I just changed the filename to point to the shortcut on
the desktop like this:

C:\Documents and Settings\Mark\Desktop\Just Monitor.lnk

That works perfectly.
 
H

Herfried K. Wagner [MVP]

Hello everyone, here is what I want to do. I have a ATI video card
and it allows me to setup profiles for monitor configurations and so
forth. The shortcut to activate one of these profiles looks like
this:

"C:\Program Files\ATI Technologies\ATI.ACE\CLI.exe" Load
profilename="Just Monitor"

Here is one example of how I've tried to do it:

returnMonitor.StartInfo.FileName = "C:\Program Files\ATI
Technologies\ATI.ACE\CLI.exe Load profilename=''Just Monitor''"

'Process.Start("C:\... \CLI.exe", "Load... ""JustMonitor""")'

Note the difference between "''" and """ (two single quotes vs. a double
quote). Each double quote must be encoded as two consecutive double quotes
inside the VB string literal.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top