Page 1 of 2 12>
Topic Options
#157657 - 2006-02-22 03:09 PM Run\Exec Question.
Arend_ Moderator Offline
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 Offline
Moderator
*****

Registered: 2000-01-06
Posts: 5187
Loc: Tampa, FL
run '%comspec% /c start "%userprofile%\desktop\something.lnk"'
_________________________
How to ask questions the smart way <-----------> Before you ask

Top
#157659 - 2006-02-22 03:35 PM Re: Run\Exec Question.
Arend_ Moderator Offline
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
#157660 - 2006-02-22 03:59 PM Re: Run\Exec Question.
Arend_ Moderator Offline
MM club member
*****

Registered: 2005-01-17
Posts: 1896
Loc: Hilversum, The Netherlands
Actually nm that. It has to do with ()'s in the dir. Spaces are fine.
Top
#157661 - 2006-02-22 04:28 PM Re: Run\Exec Question.
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
Don't use vars in strings.
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#157662 - 2006-02-22 05:28 PM Re: Run\Exec Question.
Arend_ Moderator Offline
MM club member
*****

Registered: 2005-01-17
Posts: 1896
Loc: Hilversum, The Netherlands
Easy to say, but when a string is needed in multiple functions a var is preferable.
Top
#157663 - 2006-02-22 05:57 PM Re: Run\Exec Question.
Chris S. Offline
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_ Moderator Offline
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 Offline
Moderator
*****

Registered: 2000-01-06
Posts: 5187
Loc: Tampa, FL
what doesn't work?
_________________________
How to ask questions the smart way <-----------> Before you ask

Top
#157666 - 2006-02-22 06:25 PM Re: Run\Exec Question.
Arend_ Moderator Offline
MM club member
*****

Registered: 2005-01-17
Posts: 1896
Loc: Hilversum, The Netherlands
Running a file from the path I specified in my last post.
Top
#157667 - 2006-02-22 06:39 PM Re: Run\Exec Question.
Radimus Moderator Offline
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
_________________________
How to ask questions the smart way <-----------> Before you ask

Top
#157668 - 2006-02-22 06:46 PM Re: Run\Exec Question.
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
If you want to kick something off through association and if it is not EXE, COM, or BAT, you need to use the DOS Start command.
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#157669 - 2006-02-22 06:47 PM Re: Run\Exec Question.
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
Well.. you don't really have to, you could use the FileAction() UDF.
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#157670 - 2006-02-22 06:55 PM Re: Run\Exec Question.
Arend_ Moderator Offline
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. Offline
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 Offline
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"'
_________________________
How to ask questions the smart way <-----------> Before you ask

Top
#157673 - 2006-02-22 07:10 PM Re: Run\Exec Question.
Arend_ Moderator Offline
MM club member
*****

Registered: 2005-01-17
Posts: 1896
Loc: Hilversum, The Netherlands
Same prob Chris, C:\Some not recoqnized as command.
Top
#157674 - 2006-02-22 07:12 PM Re: Run\Exec Question.
Arend_ Moderator Offline
MM club member
*****

Registered: 2005-01-17
Posts: 1896
Loc: Hilversum, The Netherlands
Radimus: thats what I ment, I didn't want kix to open it. I should have said file.txt instead of file.kix. Besides that I don't want to specify notepad.exe since it should be generic.

Think of a file listing in KixForms and a RUN button for the selected file.

Top
#157675 - 2006-02-22 07:14 PM Re: Run\Exec Question.
Radimus Moderator Offline
Moderator
*****

Registered: 2000-01-06
Posts: 5187
Loc: Tampa, FL
then say what you mean.

If the problem is your file association...
_________________________
How to ask questions the smart way <-----------> Before you ask

Top
#157676 - 2006-02-22 07:18 PM Re: Run\Exec Question.
Arend_ Moderator Offline
MM club member
*****

Registered: 2005-01-17
Posts: 1896
Loc: Hilversum, The Netherlands
The problem is NOT the file assosiation, I stated before that .kix is associated with notepad and the command works fine if the $CURRENTPATH is "C:\Documents and Settings" instead of "C:\Some Sources (KIX)\WIP".
Top
Page 1 of 2 12>


Moderator:  Arend_, Allen, Jochen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Mart 
Hop to:
Shout Box

Who's Online
0 registered and 657 anonymous users online.
Newest Members
M_Moore, BeeEm, min_seow, Audio, Hoschi
17883 Registered Users

Generated in 0.087 seconds in which 0.034 seconds were spent on a total of 13 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org