c# open file with default application and parameters
The most easy way to open a file with the default application is:
System.Diagnostics.Process.Start(@"c:myPDF.pdf");
However, I would like to know if exists a way to set parameters to the default application, because I would like to open a pdf in a determinate page number.
I know how can I do it creating a new process and set the parameters, but in this way I need to indicate the path of the application, and I would like to have a portable application and not to have to set the path of the applications each time I use the application in other computer. My idea is that I expect that the computer has installed the pdf reader and only say what page open.
Thanks.
c# file
|
show 2 more comments
The most easy way to open a file with the default application is:
System.Diagnostics.Process.Start(@"c:myPDF.pdf");
However, I would like to know if exists a way to set parameters to the default application, because I would like to open a pdf in a determinate page number.
I know how can I do it creating a new process and set the parameters, but in this way I need to indicate the path of the application, and I would like to have a portable application and not to have to set the path of the applications each time I use the application in other computer. My idea is that I expect that the computer has installed the pdf reader and only say what page open.
Thanks.
c# file
Do you mean send parameters to the Adobe executable rather than the pdf file, but without using the full path?
– Bali C
Jul 6 '12 at 16:19
2
How do you expect this to work? If you do not know the path of the application, you do not know which is the default PDF viewer, and you don't know which parameter format to use.
– ken2k
Jul 6 '12 at 16:20
2
Isn't enough to saymyProcess.StartInfo.FileName = "Acrobat.exe";
without giving the full path to the application?
– daniloquio
Jul 6 '12 at 16:23
1
Take a look at this SO question to see it helps
– Mark Hall
Jul 6 '12 at 16:25
2
@daniloquio: I think the point is that the OP doesn't know what the end user has installed on his/her machine to read adobe files with, it could be Acrobat, Acrobat Reader, or something else.
– Surfbutler
Jul 6 '12 at 16:28
|
show 2 more comments
The most easy way to open a file with the default application is:
System.Diagnostics.Process.Start(@"c:myPDF.pdf");
However, I would like to know if exists a way to set parameters to the default application, because I would like to open a pdf in a determinate page number.
I know how can I do it creating a new process and set the parameters, but in this way I need to indicate the path of the application, and I would like to have a portable application and not to have to set the path of the applications each time I use the application in other computer. My idea is that I expect that the computer has installed the pdf reader and only say what page open.
Thanks.
c# file
The most easy way to open a file with the default application is:
System.Diagnostics.Process.Start(@"c:myPDF.pdf");
However, I would like to know if exists a way to set parameters to the default application, because I would like to open a pdf in a determinate page number.
I know how can I do it creating a new process and set the parameters, but in this way I need to indicate the path of the application, and I would like to have a portable application and not to have to set the path of the applications each time I use the application in other computer. My idea is that I expect that the computer has installed the pdf reader and only say what page open.
Thanks.
c# file
c# file
asked Jul 6 '12 at 16:15
Álvaro GarcíaÁlvaro García
6,4301962116
6,4301962116
Do you mean send parameters to the Adobe executable rather than the pdf file, but without using the full path?
– Bali C
Jul 6 '12 at 16:19
2
How do you expect this to work? If you do not know the path of the application, you do not know which is the default PDF viewer, and you don't know which parameter format to use.
– ken2k
Jul 6 '12 at 16:20
2
Isn't enough to saymyProcess.StartInfo.FileName = "Acrobat.exe";
without giving the full path to the application?
– daniloquio
Jul 6 '12 at 16:23
1
Take a look at this SO question to see it helps
– Mark Hall
Jul 6 '12 at 16:25
2
@daniloquio: I think the point is that the OP doesn't know what the end user has installed on his/her machine to read adobe files with, it could be Acrobat, Acrobat Reader, or something else.
– Surfbutler
Jul 6 '12 at 16:28
|
show 2 more comments
Do you mean send parameters to the Adobe executable rather than the pdf file, but without using the full path?
– Bali C
Jul 6 '12 at 16:19
2
How do you expect this to work? If you do not know the path of the application, you do not know which is the default PDF viewer, and you don't know which parameter format to use.
– ken2k
Jul 6 '12 at 16:20
2
Isn't enough to saymyProcess.StartInfo.FileName = "Acrobat.exe";
without giving the full path to the application?
– daniloquio
Jul 6 '12 at 16:23
1
Take a look at this SO question to see it helps
– Mark Hall
Jul 6 '12 at 16:25
2
@daniloquio: I think the point is that the OP doesn't know what the end user has installed on his/her machine to read adobe files with, it could be Acrobat, Acrobat Reader, or something else.
– Surfbutler
Jul 6 '12 at 16:28
Do you mean send parameters to the Adobe executable rather than the pdf file, but without using the full path?
– Bali C
Jul 6 '12 at 16:19
Do you mean send parameters to the Adobe executable rather than the pdf file, but without using the full path?
– Bali C
Jul 6 '12 at 16:19
2
2
How do you expect this to work? If you do not know the path of the application, you do not know which is the default PDF viewer, and you don't know which parameter format to use.
– ken2k
Jul 6 '12 at 16:20
How do you expect this to work? If you do not know the path of the application, you do not know which is the default PDF viewer, and you don't know which parameter format to use.
– ken2k
Jul 6 '12 at 16:20
2
2
Isn't enough to say
myProcess.StartInfo.FileName = "Acrobat.exe";
without giving the full path to the application?– daniloquio
Jul 6 '12 at 16:23
Isn't enough to say
myProcess.StartInfo.FileName = "Acrobat.exe";
without giving the full path to the application?– daniloquio
Jul 6 '12 at 16:23
1
1
Take a look at this SO question to see it helps
– Mark Hall
Jul 6 '12 at 16:25
Take a look at this SO question to see it helps
– Mark Hall
Jul 6 '12 at 16:25
2
2
@daniloquio: I think the point is that the OP doesn't know what the end user has installed on his/her machine to read adobe files with, it could be Acrobat, Acrobat Reader, or something else.
– Surfbutler
Jul 6 '12 at 16:28
@daniloquio: I think the point is that the OP doesn't know what the end user has installed on his/her machine to read adobe files with, it could be Acrobat, Acrobat Reader, or something else.
– Surfbutler
Jul 6 '12 at 16:28
|
show 2 more comments
5 Answers
5
active
oldest
votes
EDIT (thanks to surfbutler comment in the question comments)
If you want the file to be opened with the default application, I mean without specifying Acrobat or Reader, you can't open the file in the specified page.
On the other hand, if you are Ok with specifying Acrobat or Reader, keep reading:
You can do it without telling the full Acrobat path, like this:
Process myProcess = new Process();
myProcess.StartInfo.FileName = "acroRd32.exe"; //not the full application path
myProcess.StartInfo.Arguments = "/A "page=2=OpenActions" C:\example.pdf";
myProcess.Start();
If you don't want the pdf to open with Reader but with Acrobat, chage the second line like this:
myProcess.StartInfo.FileName = "Acrobat.exe";
SECOND EDIT: Finding the default application for the pdf extension
You can query the registry to identify the default application to open pdf files and then define FileName on your process's StartInfo accordingly. Again, thanks surfbutler for your comment :)
Follow this question for details on doing that: Finding the default application for opening a particular file type on Windows
2
+1 Also I think it's possible to look up the application associated with any file type e.g. '.pdf' in the registry, then put that name in the filename parameter. See stackoverflow.com/questions/162331/…
– Surfbutler
Jul 6 '12 at 16:38
Is there some open parameter to get Adobe reader to open in 2-page view? Just curious, if someone knows, that would be real useful. I've been looking around, but I can't find anything.
– taki Martillo
Nov 6 '14 at 16:02
add a comment |
I converted the VB code in the blog post linked by xsl to C# and modified it a bit:
public static bool TryGetRegisteredApplication(
string extension, out string registeredApp)
{
string extensionId = GetClassesRootKeyDefaultValue(extension);
if (extensionId == null)
{
registeredApp = null;
return false;
}
string openCommand = GetClassesRootKeyDefaultValue(
Path.Combine(new {extensionId, "shell", "open", "command"}));
if (openCommand == null)
{
registeredApp = null;
return false;
}
registeredApp = openCommand
.Replace("%1", string.Empty)
.Replace(""", string.Empty)
.Trim();
return true;
}
private static string GetClassesRootKeyDefaultValue(string keyPath)
{
using (var key = Registry.ClassesRoot.OpenSubKey(keyPath))
{
if (key == null)
{
return null;
}
var defaultValue = key.GetValue(null);
if (defaultValue == null)
{
return null;
}
return defaultValue.ToString();
}
}
EDIT - this is unreliable. See Finding the default application for opening a particular file type on Windows.
add a comment |
you can try with
Process process = new Process();
process.StartInfo.FileName = "yourProgram.exe";
process.StartInfo.Arguments = ..... //your parameters
process.Start();
add a comment |
this should be close!
public static void OpenWithDefaultProgram(string path)
{
Process fileopener = new Process();
fileopener.StartInfo.FileName = "explorer";
fileopener.StartInfo.Arguments = """ + path + """;
fileopener.Start();
}
add a comment |
Please add Settings under Properties for the Project and make use of them this way you have clean and easy configurable settings that can be configured as default
How To: Create a New Setting at Design Time
Update: after comments below
- Right + Click on project
- Add New Item
- Under Visual C# Items -> General
- Select Settings File
11
Wrong tab maybe? ;)
– ken2k
Jul 6 '12 at 16:25
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f11365984%2fc-sharp-open-file-with-default-application-and-parameters%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
5 Answers
5
active
oldest
votes
5 Answers
5
active
oldest
votes
active
oldest
votes
active
oldest
votes
EDIT (thanks to surfbutler comment in the question comments)
If you want the file to be opened with the default application, I mean without specifying Acrobat or Reader, you can't open the file in the specified page.
On the other hand, if you are Ok with specifying Acrobat or Reader, keep reading:
You can do it without telling the full Acrobat path, like this:
Process myProcess = new Process();
myProcess.StartInfo.FileName = "acroRd32.exe"; //not the full application path
myProcess.StartInfo.Arguments = "/A "page=2=OpenActions" C:\example.pdf";
myProcess.Start();
If you don't want the pdf to open with Reader but with Acrobat, chage the second line like this:
myProcess.StartInfo.FileName = "Acrobat.exe";
SECOND EDIT: Finding the default application for the pdf extension
You can query the registry to identify the default application to open pdf files and then define FileName on your process's StartInfo accordingly. Again, thanks surfbutler for your comment :)
Follow this question for details on doing that: Finding the default application for opening a particular file type on Windows
2
+1 Also I think it's possible to look up the application associated with any file type e.g. '.pdf' in the registry, then put that name in the filename parameter. See stackoverflow.com/questions/162331/…
– Surfbutler
Jul 6 '12 at 16:38
Is there some open parameter to get Adobe reader to open in 2-page view? Just curious, if someone knows, that would be real useful. I've been looking around, but I can't find anything.
– taki Martillo
Nov 6 '14 at 16:02
add a comment |
EDIT (thanks to surfbutler comment in the question comments)
If you want the file to be opened with the default application, I mean without specifying Acrobat or Reader, you can't open the file in the specified page.
On the other hand, if you are Ok with specifying Acrobat or Reader, keep reading:
You can do it without telling the full Acrobat path, like this:
Process myProcess = new Process();
myProcess.StartInfo.FileName = "acroRd32.exe"; //not the full application path
myProcess.StartInfo.Arguments = "/A "page=2=OpenActions" C:\example.pdf";
myProcess.Start();
If you don't want the pdf to open with Reader but with Acrobat, chage the second line like this:
myProcess.StartInfo.FileName = "Acrobat.exe";
SECOND EDIT: Finding the default application for the pdf extension
You can query the registry to identify the default application to open pdf files and then define FileName on your process's StartInfo accordingly. Again, thanks surfbutler for your comment :)
Follow this question for details on doing that: Finding the default application for opening a particular file type on Windows
2
+1 Also I think it's possible to look up the application associated with any file type e.g. '.pdf' in the registry, then put that name in the filename parameter. See stackoverflow.com/questions/162331/…
– Surfbutler
Jul 6 '12 at 16:38
Is there some open parameter to get Adobe reader to open in 2-page view? Just curious, if someone knows, that would be real useful. I've been looking around, but I can't find anything.
– taki Martillo
Nov 6 '14 at 16:02
add a comment |
EDIT (thanks to surfbutler comment in the question comments)
If you want the file to be opened with the default application, I mean without specifying Acrobat or Reader, you can't open the file in the specified page.
On the other hand, if you are Ok with specifying Acrobat or Reader, keep reading:
You can do it without telling the full Acrobat path, like this:
Process myProcess = new Process();
myProcess.StartInfo.FileName = "acroRd32.exe"; //not the full application path
myProcess.StartInfo.Arguments = "/A "page=2=OpenActions" C:\example.pdf";
myProcess.Start();
If you don't want the pdf to open with Reader but with Acrobat, chage the second line like this:
myProcess.StartInfo.FileName = "Acrobat.exe";
SECOND EDIT: Finding the default application for the pdf extension
You can query the registry to identify the default application to open pdf files and then define FileName on your process's StartInfo accordingly. Again, thanks surfbutler for your comment :)
Follow this question for details on doing that: Finding the default application for opening a particular file type on Windows
EDIT (thanks to surfbutler comment in the question comments)
If you want the file to be opened with the default application, I mean without specifying Acrobat or Reader, you can't open the file in the specified page.
On the other hand, if you are Ok with specifying Acrobat or Reader, keep reading:
You can do it without telling the full Acrobat path, like this:
Process myProcess = new Process();
myProcess.StartInfo.FileName = "acroRd32.exe"; //not the full application path
myProcess.StartInfo.Arguments = "/A "page=2=OpenActions" C:\example.pdf";
myProcess.Start();
If you don't want the pdf to open with Reader but with Acrobat, chage the second line like this:
myProcess.StartInfo.FileName = "Acrobat.exe";
SECOND EDIT: Finding the default application for the pdf extension
You can query the registry to identify the default application to open pdf files and then define FileName on your process's StartInfo accordingly. Again, thanks surfbutler for your comment :)
Follow this question for details on doing that: Finding the default application for opening a particular file type on Windows
edited Aug 14 '17 at 8:26
Hakam Fostok
5,41484366
5,41484366
answered Jul 6 '12 at 16:25
daniloquiodaniloquio
3,00612649
3,00612649
2
+1 Also I think it's possible to look up the application associated with any file type e.g. '.pdf' in the registry, then put that name in the filename parameter. See stackoverflow.com/questions/162331/…
– Surfbutler
Jul 6 '12 at 16:38
Is there some open parameter to get Adobe reader to open in 2-page view? Just curious, if someone knows, that would be real useful. I've been looking around, but I can't find anything.
– taki Martillo
Nov 6 '14 at 16:02
add a comment |
2
+1 Also I think it's possible to look up the application associated with any file type e.g. '.pdf' in the registry, then put that name in the filename parameter. See stackoverflow.com/questions/162331/…
– Surfbutler
Jul 6 '12 at 16:38
Is there some open parameter to get Adobe reader to open in 2-page view? Just curious, if someone knows, that would be real useful. I've been looking around, but I can't find anything.
– taki Martillo
Nov 6 '14 at 16:02
2
2
+1 Also I think it's possible to look up the application associated with any file type e.g. '.pdf' in the registry, then put that name in the filename parameter. See stackoverflow.com/questions/162331/…
– Surfbutler
Jul 6 '12 at 16:38
+1 Also I think it's possible to look up the application associated with any file type e.g. '.pdf' in the registry, then put that name in the filename parameter. See stackoverflow.com/questions/162331/…
– Surfbutler
Jul 6 '12 at 16:38
Is there some open parameter to get Adobe reader to open in 2-page view? Just curious, if someone knows, that would be real useful. I've been looking around, but I can't find anything.
– taki Martillo
Nov 6 '14 at 16:02
Is there some open parameter to get Adobe reader to open in 2-page view? Just curious, if someone knows, that would be real useful. I've been looking around, but I can't find anything.
– taki Martillo
Nov 6 '14 at 16:02
add a comment |
I converted the VB code in the blog post linked by xsl to C# and modified it a bit:
public static bool TryGetRegisteredApplication(
string extension, out string registeredApp)
{
string extensionId = GetClassesRootKeyDefaultValue(extension);
if (extensionId == null)
{
registeredApp = null;
return false;
}
string openCommand = GetClassesRootKeyDefaultValue(
Path.Combine(new {extensionId, "shell", "open", "command"}));
if (openCommand == null)
{
registeredApp = null;
return false;
}
registeredApp = openCommand
.Replace("%1", string.Empty)
.Replace(""", string.Empty)
.Trim();
return true;
}
private static string GetClassesRootKeyDefaultValue(string keyPath)
{
using (var key = Registry.ClassesRoot.OpenSubKey(keyPath))
{
if (key == null)
{
return null;
}
var defaultValue = key.GetValue(null);
if (defaultValue == null)
{
return null;
}
return defaultValue.ToString();
}
}
EDIT - this is unreliable. See Finding the default application for opening a particular file type on Windows.
add a comment |
I converted the VB code in the blog post linked by xsl to C# and modified it a bit:
public static bool TryGetRegisteredApplication(
string extension, out string registeredApp)
{
string extensionId = GetClassesRootKeyDefaultValue(extension);
if (extensionId == null)
{
registeredApp = null;
return false;
}
string openCommand = GetClassesRootKeyDefaultValue(
Path.Combine(new {extensionId, "shell", "open", "command"}));
if (openCommand == null)
{
registeredApp = null;
return false;
}
registeredApp = openCommand
.Replace("%1", string.Empty)
.Replace(""", string.Empty)
.Trim();
return true;
}
private static string GetClassesRootKeyDefaultValue(string keyPath)
{
using (var key = Registry.ClassesRoot.OpenSubKey(keyPath))
{
if (key == null)
{
return null;
}
var defaultValue = key.GetValue(null);
if (defaultValue == null)
{
return null;
}
return defaultValue.ToString();
}
}
EDIT - this is unreliable. See Finding the default application for opening a particular file type on Windows.
add a comment |
I converted the VB code in the blog post linked by xsl to C# and modified it a bit:
public static bool TryGetRegisteredApplication(
string extension, out string registeredApp)
{
string extensionId = GetClassesRootKeyDefaultValue(extension);
if (extensionId == null)
{
registeredApp = null;
return false;
}
string openCommand = GetClassesRootKeyDefaultValue(
Path.Combine(new {extensionId, "shell", "open", "command"}));
if (openCommand == null)
{
registeredApp = null;
return false;
}
registeredApp = openCommand
.Replace("%1", string.Empty)
.Replace(""", string.Empty)
.Trim();
return true;
}
private static string GetClassesRootKeyDefaultValue(string keyPath)
{
using (var key = Registry.ClassesRoot.OpenSubKey(keyPath))
{
if (key == null)
{
return null;
}
var defaultValue = key.GetValue(null);
if (defaultValue == null)
{
return null;
}
return defaultValue.ToString();
}
}
EDIT - this is unreliable. See Finding the default application for opening a particular file type on Windows.
I converted the VB code in the blog post linked by xsl to C# and modified it a bit:
public static bool TryGetRegisteredApplication(
string extension, out string registeredApp)
{
string extensionId = GetClassesRootKeyDefaultValue(extension);
if (extensionId == null)
{
registeredApp = null;
return false;
}
string openCommand = GetClassesRootKeyDefaultValue(
Path.Combine(new {extensionId, "shell", "open", "command"}));
if (openCommand == null)
{
registeredApp = null;
return false;
}
registeredApp = openCommand
.Replace("%1", string.Empty)
.Replace(""", string.Empty)
.Trim();
return true;
}
private static string GetClassesRootKeyDefaultValue(string keyPath)
{
using (var key = Registry.ClassesRoot.OpenSubKey(keyPath))
{
if (key == null)
{
return null;
}
var defaultValue = key.GetValue(null);
if (defaultValue == null)
{
return null;
}
return defaultValue.ToString();
}
}
EDIT - this is unreliable. See Finding the default application for opening a particular file type on Windows.
edited May 23 '17 at 12:10
Community♦
11
11
answered Jul 21 '13 at 14:47
Ohad SchneiderOhad Schneider
26.4k10121157
26.4k10121157
add a comment |
add a comment |
you can try with
Process process = new Process();
process.StartInfo.FileName = "yourProgram.exe";
process.StartInfo.Arguments = ..... //your parameters
process.Start();
add a comment |
you can try with
Process process = new Process();
process.StartInfo.FileName = "yourProgram.exe";
process.StartInfo.Arguments = ..... //your parameters
process.Start();
add a comment |
you can try with
Process process = new Process();
process.StartInfo.FileName = "yourProgram.exe";
process.StartInfo.Arguments = ..... //your parameters
process.Start();
you can try with
Process process = new Process();
process.StartInfo.FileName = "yourProgram.exe";
process.StartInfo.Arguments = ..... //your parameters
process.Start();
answered Jul 6 '12 at 16:18
Aghilas YakoubAghilas Yakoub
24.4k43038
24.4k43038
add a comment |
add a comment |
this should be close!
public static void OpenWithDefaultProgram(string path)
{
Process fileopener = new Process();
fileopener.StartInfo.FileName = "explorer";
fileopener.StartInfo.Arguments = """ + path + """;
fileopener.Start();
}
add a comment |
this should be close!
public static void OpenWithDefaultProgram(string path)
{
Process fileopener = new Process();
fileopener.StartInfo.FileName = "explorer";
fileopener.StartInfo.Arguments = """ + path + """;
fileopener.Start();
}
add a comment |
this should be close!
public static void OpenWithDefaultProgram(string path)
{
Process fileopener = new Process();
fileopener.StartInfo.FileName = "explorer";
fileopener.StartInfo.Arguments = """ + path + """;
fileopener.Start();
}
this should be close!
public static void OpenWithDefaultProgram(string path)
{
Process fileopener = new Process();
fileopener.StartInfo.FileName = "explorer";
fileopener.StartInfo.Arguments = """ + path + """;
fileopener.Start();
}
edited Jan 20 at 11:33
answered Jan 20 at 9:27
jessie tessiejessie tessie
11
11
add a comment |
add a comment |
Please add Settings under Properties for the Project and make use of them this way you have clean and easy configurable settings that can be configured as default
How To: Create a New Setting at Design Time
Update: after comments below
- Right + Click on project
- Add New Item
- Under Visual C# Items -> General
- Select Settings File
11
Wrong tab maybe? ;)
– ken2k
Jul 6 '12 at 16:25
add a comment |
Please add Settings under Properties for the Project and make use of them this way you have clean and easy configurable settings that can be configured as default
How To: Create a New Setting at Design Time
Update: after comments below
- Right + Click on project
- Add New Item
- Under Visual C# Items -> General
- Select Settings File
11
Wrong tab maybe? ;)
– ken2k
Jul 6 '12 at 16:25
add a comment |
Please add Settings under Properties for the Project and make use of them this way you have clean and easy configurable settings that can be configured as default
How To: Create a New Setting at Design Time
Update: after comments below
- Right + Click on project
- Add New Item
- Under Visual C# Items -> General
- Select Settings File
Please add Settings under Properties for the Project and make use of them this way you have clean and easy configurable settings that can be configured as default
How To: Create a New Setting at Design Time
Update: after comments below
- Right + Click on project
- Add New Item
- Under Visual C# Items -> General
- Select Settings File
edited Jul 6 '12 at 17:03
answered Jul 6 '12 at 16:24
HatSoftHatSoft
9,63231943
9,63231943
11
Wrong tab maybe? ;)
– ken2k
Jul 6 '12 at 16:25
add a comment |
11
Wrong tab maybe? ;)
– ken2k
Jul 6 '12 at 16:25
11
11
Wrong tab maybe? ;)
– ken2k
Jul 6 '12 at 16:25
Wrong tab maybe? ;)
– ken2k
Jul 6 '12 at 16:25
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f11365984%2fc-sharp-open-file-with-default-application-and-parameters%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Do you mean send parameters to the Adobe executable rather than the pdf file, but without using the full path?
– Bali C
Jul 6 '12 at 16:19
2
How do you expect this to work? If you do not know the path of the application, you do not know which is the default PDF viewer, and you don't know which parameter format to use.
– ken2k
Jul 6 '12 at 16:20
2
Isn't enough to say
myProcess.StartInfo.FileName = "Acrobat.exe";
without giving the full path to the application?– daniloquio
Jul 6 '12 at 16:23
1
Take a look at this SO question to see it helps
– Mark Hall
Jul 6 '12 at 16:25
2
@daniloquio: I think the point is that the OP doesn't know what the end user has installed on his/her machine to read adobe files with, it could be Acrobat, Acrobat Reader, or something else.
– Surfbutler
Jul 6 '12 at 16:28