Discussion:
How do you run a One-Click application from PowerShell
(too old to reply)
RickB
2008-12-09 20:34:19 UTC
Permalink
Every day a user runs this application manually.
Basically, only because I can't figure out how to schedule it.

The application is written in VB.NET and deployed to a server as a
OneClick application.
The main procedure looks for a filename argument and if none is found
it presents an Open Dialog for a user to select a file to process. I
can find the proper file with PowerShell so no user would really be
needed except I can't figure out how to call the thing with the name
of the file as an argument.

The app is already installed so I don't need PowerShell to worry about
whether it is or not.

Manually it gets run from a link on the desktop.

PS 12:11:08 7> type '.\Argus Extract.appref-ms'
file://pmsratl4/vol0/Public_Install/RAS-IT/Argus_Extract/Argus_Extract.application#Argus_Extract.application,
Culture=neutral, PublicKeyToken=a1be66985b0d9f07,
processorArchitecture=msil


Thanks
Marco Shaw [MVP]
2008-12-10 16:00:47 UTC
Permalink
Post by RickB
Manually it gets run from a link on the desktop.
PS 12:11:08 7> type '.\Argus Extract.appref-ms'
file://pmsratl4/vol0/Public_Install/RAS-IT/Argus_Extract/Argus_Extract.application#Argus_Extract.application,
Culture=neutral, PublicKeyToken=a1be66985b0d9f07,
processorArchitecture=msil
I don't follow how the link works... Can you call it from DOS and/or
PowerShell? Is it an .exe?

Marco
--
*Microsoft MVP - Admin Frameworks
https://mvp.support.microsoft.com/profile/Marco.Shaw
*Co-Author - Sams Windows PowerShell Unleashed 2nd Edition (due December
15th, 2008)
*PowerShell Co-Community Director - http://www.powershellcommunity.org
*Blog - http://marcoshaw.blogspot.com
RickB
2008-12-15 22:05:19 UTC
Permalink
On Dec 10, 10:00 am, "Marco Shaw [MVP]"
Post by RickB
Manually it gets run from a link on the desktop.
PS 12:11:08 7> type '.\Argus Extract.appref-ms'
file://pmsratl4/vol0/Public_Install/RAS-IT/Argus_Extract/Argus_Extract.appl­ication#Argus_Extract.application,
Culture=neutral, PublicKeyToken=a1be66985b0d9f07,
processorArchitecture=msil
I don't follow how the link works...  Can you call it from DOS and/or
PowerShell?  Is it an .exe?
Marco
--
*Microsoft MVP - Admin Frameworkshttps://mvp.support.microsoft.com/profile/Marco.Shaw
*Co-Author - Sams Windows PowerShell Unleashed 2nd Edition (due December
15th, 2008)
*PowerShell Co-Community Director -http://www.powershellcommunity.org
*Blog -http://marcoshaw.blogspot.com
Me neither. That's the problem.

When I install this app it puts a shortcut on my start menu.
The filename of the shortcut and the text it contains are all I have
to go on.
When I click on that shortcut it runs the application.
I can also run the app from PowerShell like this.

& '.\Argus Extract.appref-ms'

But I can't seem to pass an argument.

if I do this

& '.\Argus Extract.appref-ms' 'c:\some\file\here.txt'

I don't get an error but the app doesn't see it iether.
I'm hoping that something like adding ', args=filename' to the text
inside the link is what I need to do.
But I can't find any documentation on arguments to one-click
applications.
Not even the ones like Culture=neutral, PublicKeyToken.... that are in
the link now.
But obviously 'args' is not the correct keyword
After attempting that I did get an error and it makes me think that
there may not be any way to pass an arg to a oneclick app but I'd
rather hear that from somebody who knows rather than just make the
assumption.
It's really causing me heartburn that this must be run manually.

Thanks
RickB
2008-12-16 17:18:15 UTC
Permalink
Post by RickB
On Dec 10, 10:00 am, "Marco Shaw [MVP]"
Post by RickB
Manually it gets run from a link on the desktop.
PS 12:11:08 7> type '.\Argus Extract.appref-ms'
file://pmsratl4/vol0/Public_Install/RAS-IT/Argus_Extract/Argus_Extract.appl­­ication#Argus_Extract.application,
Culture=neutral, PublicKeyToken=a1be66985b0d9f07,
processorArchitecture=msil
I don't follow how the link works...  Can you call it from DOS and/or
PowerShell?  Is it an .exe?
Marco
--
*Microsoft MVP - Admin Frameworkshttps://mvp.support.microsoft.com/profile/Marco.Shaw
*Co-Author - Sams Windows PowerShell Unleashed 2nd Edition (due December
15th, 2008)
*PowerShell Co-Community Director -http://www.powershellcommunity.org
*Blog -http://marcoshaw.blogspot.com
Me neither.  That's the problem.
When I install this app it puts a shortcut on my start menu.
The filename of the shortcut and the text it contains are all I have
to go on.
When I click on that shortcut it runs the application.
I can also run the app from PowerShell like this.
& '.\Argus Extract.appref-ms'
But I can't seem to pass an argument.
if I do this
& '.\Argus Extract.appref-ms' 'c:\some\file\here.txt'
I don't get an error but the app doesn't see it iether.
I'm hoping that something like adding ', args=filename' to the text
inside the link is what I need to do.
But I can't find any documentation on arguments to one-click
applications.
Not even the ones like Culture=neutral, PublicKeyToken.... that are in
the link now.
But obviously 'args' is not the correct keyword
After attempting that I did get an error and it makes me think that
there may not be any way to pass an arg to a oneclick app but I'd
rather hear that from somebody who knows rather than just make the
assumption.
It's really causing me heartburn that this must be run manually.
Thanks- Hide quoted text -
- Show quoted text -
Unfortunately the trouble seems to be in the application.

I found this quote on a page that describes what's required.

http://msdn.microsoft.com/en-us/library/ms172242(VS.80).aspx

"It is not possible to pass command-line arguments to a ClickOnce
application."
JMinnick
2008-12-12 21:18:10 UTC
Permalink
RickB,

How do you supply an argument for this application if you do not use the
"Open file" dialog box? Do the users interact with this application in a web
browser?
Post by RickB
Every day a user runs this application manually.
Basically, only because I can't figure out how to schedule it.
The application is written in VB.NET and deployed to a server as a
OneClick application.
The main procedure looks for a filename argument and if none is found
it presents an Open Dialog for a user to select a file to process. I
can find the proper file with PowerShell so no user would really be
needed except I can't figure out how to call the thing with the name
of the file as an argument.
The app is already installed so I don't need PowerShell to worry about
whether it is or not.
Manually it gets run from a link on the desktop.
PS 12:11:08 7> type '.\Argus Extract.appref-ms'
file://pmsratl4/vol0/Public_Install/RAS-IT/Argus_Extract/Argus_Extract.application#Argus_Extract.application,
Culture=neutral, PublicKeyToken=a1be66985b0d9f07,
processorArchitecture=msil
Thanks
RickB
2008-12-15 21:30:30 UTC
Permalink
Post by JMinnick
RickB,
How do you supply an argument for this application if you do not use the
"Open file" dialog box? Do the users interact with this application in a web
browser?
Post by RickB
Every day a user runs this application manually.
Basically, only because I can't figure out how to schedule it.
The application is written in VB.NET and deployed to a server as a
OneClick application.
The main procedure looks for a filename argument and if none is found
it presents an Open Dialog for a user to select a file to process.  I
can find the proper file with PowerShell so no user would really be
needed except I can't figure out how to call the thing with the name
of the file as an argument.
The app is already installed so I don't need PowerShell to worry about
whether it is or not.
Manually it gets run from a link on the desktop.
PS 12:11:08 7> type '.\Argus Extract.appref-ms'
file://pmsratl4/vol0/Public_Install/RAS-IT/Argus_Extract/Argus_Extract.appl­ication#Argus_Extract.application,
Culture=neutral, PublicKeyToken=a1be66985b0d9f07,
processorArchitecture=msil
Thanks- Hide quoted text -
- Show quoted text -
You are hitting the nail on the head.
I don't know how.
The application main proc is coded like this


Function Main(ByVal cmdArgs() As String) As Integer
...
If CmdArgs.Length > 0 Then
InputFileNameValue = CmdArgs(0)
Else
' This pops up a dialog to get user input.
InputFileNameValue = get_input_filename()
End If

Then it gets deployed as a one click app.
When I click on the shortcut the app runs but since I didn't pass any
args it pops up the dialog.

I can't figure out how to run this from CMD or PowerShell.
Marco Shaw [MVP]
2008-12-18 14:45:54 UTC
Permalink
Post by RickB
Function Main(ByVal cmdArgs() As String) As Integer
...
If CmdArgs.Length > 0 Then
InputFileNameValue = CmdArgs(0)
Else
' This pops up a dialog to get user input.
InputFileNameValue = get_input_filename()
End If
Then it gets deployed as a one click app.
When I click on the shortcut the app runs but since I didn't pass any
args it pops up the dialog.
I can't figure out how to run this from CMD or PowerShell.
So you can change how the app gets packaged by changing this code?

Marco
--
*Microsoft MVP - Admin Frameworks
https://mvp.support.microsoft.com/profile/Marco.Shaw
*Co-Author - Sams Windows PowerShell Unleashed 2nd Edition (due December
15th, 2008)
*PowerShell Co-Community Director - http://www.powershellcommunity.org
*Blog - http://marcoshaw.blogspot.com
Loading...