#157657 - 2006-02-22 03:09 PM
Run\Exec Question.
|
Arend_
MM club member
   
Registered: 2005-01-17
Posts: 1896
Loc: Hilversum, The Netherlands
|
Anyone have any idea how to run .lnk or .rar files ? without having to use explorer.exe or rar.exe ?
Ideally something like $ComScript.Run("%userprofile\desktop\something.lnk")
I'd be gratefull
|
|
Top
|
|
|
|
#157658 - 2006-02-22 03:25 PM
Re: Run\Exec Question.
|
Radimus
Moderator
   
Registered: 2000-01-06
Posts: 5187
Loc: Tampa, FL
|
run '%comspec% /c start "%userprofile%\desktop\something.lnk"'
|
|
Top
|
|
|
|
#157659 - 2006-02-22 03:35 PM
Re: Run\Exec Question.
|
Arend_
MM club member
   
Registered: 2005-01-17
Posts: 1896
Loc: Hilversum, The Netherlands
|
Thx Radimus, it works perfectly  Run should have that integrated...
Although it does have problems with spaced directories... Code:
$file = "M:\Some dir with spaces\file.ext" run '%comspec% /c "$file"'
gives the error that it cannot run "M:\Some"
Edited by apronk (2006-02-22 03:45 PM)
|
|
Top
|
|
|
|
#157663 - 2006-02-22 05:57 PM
Re: Run\Exec Question.
|
Chris S.
MM club member
   
Registered: 2002-03-18
Posts: 2368
Loc: Earth
|
You misunderstood what Les is telling you. You are not properly formatting your command to use variables in your quotes...
Code:
$file = "M:\Some dir with spaces\file.ext" run %comspec% + ' /c "' + $file + '"'
Edited by Chris S. (2006-02-22 05:59 PM)
|
|
Top
|
|
|
|
#157664 - 2006-02-22 06:20 PM
Re: Run\Exec Question.
|
Arend_
MM club member
   
Registered: 2005-01-17
Posts: 1896
Loc: Hilversum, The Netherlands
|
Ok Fair enough, but the code you specified doesn't work either. 
Try this for a directory: "C:\TestDir (for me)\subdir\file.ext"
|
|
Top
|
|
|
|
#157665 - 2006-02-22 06:23 PM
Re: Run\Exec Question.
|
Radimus
Moderator
   
Registered: 2000-01-06
Posts: 5187
Loc: Tampa, FL
|
|
|
Top
|
|
|
|
#157667 - 2006-02-22 06:39 PM
Re: Run\Exec Question.
|
Radimus
Moderator
   
Registered: 2000-01-06
Posts: 5187
Loc: Tampa, FL
|
provide the entire command that you are trying to execute... perhaps even some of the code
|
|
Top
|
|
|
|
#157670 - 2006-02-22 06:55 PM
Re: Run\Exec Question.
|
Arend_
MM club member
   
Registered: 2005-01-17
Posts: 1896
Loc: Hilversum, The Netherlands
|
Code:
$CURRENTPATH = "C:\Some Sources (KIX)\WIP" $CURRENTITEM = "test.kix" $sItem = $CURRENTPATH + "\" + $CURRENTITEM Run '%comspec% /c "$sItem"'
The problem resides in the path, if I put the file in C:\Documents and Settings\test.kix the command works fine. But from the path I specified in the code it does not. You get a DOS error saying can't find "C:\Some"
[edit] Les: Specifying the "start" part of the code doesn't get me anywhere at all. [/edit] [edit2] Like I said before it's due to the ()'s. If you goto cmd.exe and specify cmd /? it will tel you so in the last line. [/edit2]
Edited by apronk (2006-02-22 07:08 PM)
|
|
Top
|
|
|
|
#157671 - 2006-02-22 07:08 PM
Re: Run\Exec Question.
|
Chris S.
MM club member
   
Registered: 2002-03-18
Posts: 2368
Loc: Earth
|
Code:
Run '%comspec% /c "' + $sItem + '"'
...assuming that .kix files are associated with kix32.exe. If not, specify the path to the executable as well.
|
|
Top
|
|
|
|
#157672 - 2006-02-22 07:09 PM
Re: Run\Exec Question.
|
Radimus
Moderator
   
Registered: 2000-01-06
Posts: 5187
Loc: Tampa, FL
|
funny... it works fine for me when I do:
break on
$CURRENTPATH = "C:\Some Sources (KIX)\WIP" $CURRENTITEM = "mcafeemanager3.kix" $sItem = $CURRENTPATH + "\" + $CURRENTITEM Run 'kix32 "$sItem"'
|
|
Top
|
|
|
|
#157675 - 2006-02-22 07:14 PM
Re: Run\Exec Question.
|
Radimus
Moderator
   
Registered: 2000-01-06
Posts: 5187
Loc: Tampa, FL
|
then say what you mean.
If the problem is your file association...
|
|
Top
|
|
|
|
Moderator: Arend_, Allen, Jochen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Mart
|
0 registered
and 837 anonymous users online.
|
|
|