Quick question:

Can i somehow set a property for a batch file, such that any file i drag over it will act as its %1 property...?


For example:

Build.Bat. If i drag say MyAsm.Asm onto the Bat file in the directory, can i set some flag such that %1 in the Bat file is "MyAsm.Asm" ??


Regards,
:NaN:
Posted on 2004-06-13 19:44:11 by NaN
Yes, that is how it already works. For example I tried this...

echo %1
pause

and it displayed the name of the file dropped onto it's icon.
Posted on 2004-06-13 20:13:01 by donkey
Thats what i thought would happen, but i tried it with my XP machine and doesnt respond.

To be honest, i have a number of *issues* with the CMD and Batch uses with this OS version. For one, i can't find anyway of keeping the window open after runing a batch file (so i can read its output). I have to run batches only from a CMD window if i need to know outputs. Another problem is there appears to be no way of specifying the start up directory when your Run->CMD.EXE so you have to directory surf to where your working.

This all use to be so much simpler on Win98.

Regards,
:NaN:
Posted on 2004-06-13 20:18:07 by NaN

Thats what i thought would happen, but i tried it with my XP machine and doesnt respond.

To be honest, i have a number of *issues* with the CMD and Batch uses with this OS version. For one, i can't find anyway of keeping the window open after runing a batch file (so i can read its output). I have to run batches only from a CMD window if i need to know outputs. Another problem is there appears to be no way of specifying the start up directory when your Run->CMD.EXE so you have to directory surf to where your working.

This all use to be so much simpler on Win98.

Regards,
:NaN:


Put "pause" at the end of the batch file. That will let you see the output.
Bye.
Posted on 2004-06-13 20:22:17 by GogetaSSJ4
Funny, I would have thought that XP would be the same as Win2K which is what I used. Just to make sure I tried it on NT4/95 and 98SE and it worked properly on all of them. Pretty stupid if they broke it for XP.
Posted on 2004-06-13 20:24:26 by donkey

Another problem is there appears to be no way of specifying the start up directory when your Run->CMD.EXE so you have to directory surf to where your working.


Maybe you would find the "Open Command Window Here" Powertoy from MS useful:

http://www.microsoft.com/windowsxp/pro/downloads/powertoys.asp
http://download.microsoft.com/download/whistler/Install/2/WXP/EN-US/CmdHerePowertoySetup.exe
Posted on 2004-06-13 22:01:17 by stormix
Thanks for your help. While ultimately it was my error, your replies assured me that there must be something deeping going on. And there was... It *appeared* that the drag & drop batch file was not working because the batch file i wrote was far more complicated than the simple "echo %1". Turned out it was how i format and evaulate the parameters that fooled me. That and the fact the window doesnt stick around long enought to clearly get a read on it :rolleyes:


As for the power tools link, Thanks alot! It sounds just like what im looking for!

:alright:
:NaN:
Posted on 2004-06-13 23:10:08 by NaN
Hi NaN,

I use Delight's registry hack for the Command Prompt Here...

http://www.asmcommunity.net/board/index.php?topic=12855
Posted on 2004-06-13 23:28:29 by donkey
Thanks Donkey, I forgot about that link... Its perfect. Now if i can only somehow set the window to not close automatically after running a batch file.. i would be set ;)

Regards,
:NaN:
Posted on 2004-06-13 23:46:38 by NaN
properties->advanced dos settings or something "don't close on exit" (don't have a windows here to check but that's how it's done)
Posted on 2004-06-14 02:59:36 by Hiroshimator

Another problem is there appears to be no way of specifying the start up directory when your Run->CMD.EXE so you have to directory surf to where your working.

You can set your "home directory" - I can't remember the registry path nor if you can change it with Tweak UI, but it exists, and does exactly what you want. Also, Command Prompt Here is nice :)


Now if i can only somehow set the window to not close automatically after running a batch file.. i would be set

Just run "pause" from the batch file


properties->advanced dos settings or something "don't close on exit" (don't have a windows here to check but that's how it's done)

Hiro, I'm afraid that doesn't work on NT - certainly can't find it for cmd.exe, and dos apps are something quite different :)
Posted on 2004-06-14 08:59:12 by f0dder
I would rather not have to modify all my batch files to suit the XP philosophy if i can.

Regards,
:NaN:
Posted on 2004-06-14 11:42:28 by NaN
It's not XP philosophy, NT has been that way all along afaik. The idea is somewhat logical I guess - when an application terminates, you expect it to terminate, not stick around. Keeping the console window open would mean "sticking around". Furthermore, the general idea is that you run GUI apps, and if you run console apps you run them from a cmd.exe shell, where you can see the output even after the app is gone.

But sure, it would have been nifty if there was some "stick around until I close the console window if not launched from a parent console app" option. You could workaround by writing a console-mode application that executes cmd.exe with batch file as argument, but doesn't close it's main window, and then change the filetype handler for .bat from cmd.exe to your app...
Posted on 2004-06-14 11:56:20 by f0dder
I used it for mom, why wouldn't it work for anything else dos? :notsure: (and I used 2K)
Posted on 2004-06-14 13:12:19 by Hiroshimator
Hiro, there was such an option in Win9x, but I haven't seen it in 2k or xp... unless you're talking about something obscure like making a schortcut to command.com and having special parms there (and *yuck* running command.com when you have cmd.exe ...)
Posted on 2004-06-14 13:33:36 by f0dder

It's not XP philosophy, NT has been that way all along afaik. The idea is somewhat logical I guess - when an application terminates, you expect it to terminate, not stick around. Keeping the console window open would mean "sticking around". Furthermore, the general idea is that you run GUI apps, and if you run console apps you run them from a cmd.exe shell, where you can see the output even after the app is gone.

But sure, it would have been nifty if there was some "stick around until I close the console window if not launched from a parent console app" option. You could workaround by writing a console-mode application that executes cmd.exe with batch file as argument, but doesn't close it's main window, and then change the filetype handler for .bat from cmd.exe to your app...


Looks like i have somethimg to do the.... (seing my wish list thread is not working out as well as planned)

:NaN:
Posted on 2004-06-14 15:44:36 by NaN
Another Q:

I've been scouring the net, but cant seem to get a straight answer.

Is there a way to String Process the %1 variable in a batch file?

If you drag & Drop a file onto a batch file, %1 will == "Drive:\Path\Filename.ext", and i need to process it to drop the extension. Is this possible? I did read NT/2000/XP will handle this, but i was hoping to make the batch file universal to NT/9X based systems...

Regards,
:NaN:
Posted on 2004-06-19 13:03:44 by NaN
Hi NaN,

At this point wouldn't you be better off using a console application to do that for you ? When you start to parse and compare and modify strings it is a little beyond the scope of a batch file. This is how I would tackle the problem...

Write a custom batch processor, say NaNBat.exe
Make a new file extension for example .NaN
Register the extension and make it's default "Open With" application NaNBat.exe

That way you can do whatever you like and add any feature you want. All you would have to do is distribute NaNBat.exe but there are many other custom batch processors out there so it would be nothing new.

The process of setting the default "Open With" can be automated by putting NaNBat.exe in HKLM\Applications and then setting the "Open With " application in HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts
Posted on 2004-06-19 13:19:06 by donkey
Its a good idea.. and i will admit I am getting a bit of tunnel vision here. Thanks for the reality check... :alright:

:NaN:
Posted on 2004-06-19 14:23:32 by NaN
...or perhaps pick up one of those pesky scripting languages, like perl or pything? :)
Posted on 2004-06-21 06:36:28 by f0dder