#193000 - 2009-03-19 05:50 PM
Combine BAT/CMD and KIX into one file
|
Albertane
Just in Town
Registered: 2009-03-19
Posts: 3
Loc: Eagan, MN, USA
|
I didn't see how to do this anywhere so I figured it out myself. I figured I should post it so it might be of use to others.
I often write short scripts that I would like to be able to be run just by double clicking on a computer that might not have file associations set up to run Kixtart when double-clicking a KIX file. In the past, I've had to make a CMD file to go along with each KIX file that would start kix32.exe and run the KIX file. This method combines both files into one so that you can just double-click on a BAT or CMD file that starts kix32.exe and runs itself. The BAT commands are ignored by KiXtart and the KiXtart commands are ignored by the command interpreter.
Put this in a file with a BAT or CMD extension:
;@echo off
;echo This is a batch file command.
;"%~dp0\kix32.exe" "%~f0" %*
;pause
;exit
? "This is a KiXtart command."
?
KIX32.EXE must be in the same directory as the CMD file. If not, change the %~dp0 to the path of KIX32.EXE. Delete the ";pause" line if you don't want "Press any key to continue" to be shown after the script is finished.
Edited by Albertane (2009-03-19 10:12 PM)
|
Top
|
|
|
|
#193018 - 2009-03-19 10:03 PM
Re: Combine BAT/CMD and KIX into one file
[Re: Glenn Barnas]
|
Albertane
Just in Town
Registered: 2009-03-19
Posts: 3
Loc: Eagan, MN, USA
|
Interesting... kind of like specifying the desired shell intepreter in a Unix script. Exactly. That's where I got the idea.
You might want to simply pass %* instead of the individual 10 args. I was thinking there was something like that. I should have just tried it. I'll change my original post.
I also realized there's a bug too. %0 doesn't expand to include the file extension if you run the batch file from a command line. Using %~f0 instead fixes that.
Edited by Albertane (2009-03-19 10:05 PM)
|
Top
|
|
|
|
#193019 - 2009-03-19 10:08 PM
Re: Combine BAT/CMD and KIX into one file
[Re: NTDOC]
|
Albertane
Just in Town
Registered: 2009-03-19
Posts: 3
Loc: Eagan, MN, USA
|
It should work quite well Glenn. Basic batch stuff there. To be honest though I can't recall in almost 10 years now of doing this that I've done more than a very basic edit or run of "test" scripts on another box beyond my own. I've written a lot of little scripts to fix things on people's computers. So I have a directory on one of our file server with a bunch of .CMD/.KIX file pairs. Now I can get rid of half of those files.
|
Top
|
|
|
|
Moderator: Glenn Barnas, NTDOC, Arend_, Jochen, Radimus, Allen, ShaneEP, Ruud van Velsen, Mart
|
0 registered
and 507 anonymous users online.
|
|
|