Some program like UNIX 'file', but for Windows?

C

Chaos Master

Mike Henley writes within:
I installed cygwin a few times in the past; installation was easy,
only thing was, i couldn't find tutorials on how to use it once it was
installed. Does anyone know any tutorials on how a lifetime windows
user can use cygwin after installation?

It creates a UNIX 'shell' in your system, creating shortcuts to 'Cygwin BASH'.
Click on the shortcut, you'll soon have a prompt '$'.

Then you can give UNIX commands on the prompt.



--
Chaos Master®, posting from Brazil.
"Two of the most famous products of Berkeley are LSD and Unix. I don't think
that this is a coincidence." -- Anonymous
"I'd rather be hated for who I am, than loved for who I am not" - Kurt Cobain
"F*** you, pal. " -- Amy Lee

The Evanescen(t/ce) HP: http://marreka.no-ip.com
 
B

Bjorn Simonsen

omega wrote in said:
If I ever get back to teaching "intro to computers," I could use it
as a first day hand-out, for the students to study. The students
I used to get (good-hearted seniors), they were very vulnerable at
that stage, and they believed every word one uttered.

You'll have to "live" the GUI world of Windows for quite some time for
things to make sense, <http://aumha.org/a/budnlou.htm>, so no wonder
new students may seem somewhat gullible. :)

All the best,
Bjorn Simonsne
 
O

omega

Bjorn Simonsen said:
You'll have to "live" the GUI world of Windows for quite some time for
things to make sense, <http://aumha.org/a/budnlou.htm>, so no wonder
new students may seem somewhat gullible. :)

Thank you for the URL. Very apt! That was exactly one of the things
I had to teach. Getting the students to accept that when you want to
Stop, you choose Start.
 
O

omega

Bjorn Simonsen said:
You'll have to "live" the GUI world of Windows for quite some time for
things to make sense, <http://aumha.org/a/budnlou.htm>, so no wonder
new students may seem somewhat gullible. :)

Microsoft starring as the lead buffoon in this play. :)

| Costello: Look, if I want to turn off the computer, I am willing
| to press the Stop button, the End button, even the Cease and Desist
| button, but no one in their right mind presses the Start to Stop.
 
R

Rod

Thank you for the URL. Very apt! That was exactly one of the things
I had to teach. Getting the students to accept that when you want to
Stop, you choose Start.

My dad was so confused by the shutdown-through-start-procedure in win98
that I told him to keep pressing Alt-F4 till the little shutdown-box
appeared. That he could live with as it made sense to him that there's one
command that had the same effect on all the stuff he uses.

Rod
 
S

Sietse Fliege

omega said:
"I have a PIF file and it won't run and I don't know why!"

(Guess you can figure out that was just a typo.)

Them pifruns and runpifs do your head in! :)
 
S

Sietse Fliege

omega wrote:

<Snipped a lot and changed order a bit for clarity.)

Sorry, Karen, for the delay. Have been away a few days.
(Btw, here is a brief visual description of what I was trying to
describe: http://omega5.port5.com/clips/0925/index.htm )

Wow!. I said that a concrete example would be helpful, but this is
extremely well done. Very clear now! Thanks a lot!
With all this complete info I could exactly reproduce your situation on
my Win95B box.
---PifRun.bat------
explorer /e,/root,"%1"
cd %1
start run.pif

This suggests that it also worked without the extra explorer window,
but...
As I said, I tend to want to get the program's folder opened at the
same time as the program launch, some ~majority of time. So I am not
malcontent here. I'd mainly brought it up as an example of a
situation where I could not get local pifs to launch. That if it was
the case I did -not- want that extra explorer window opened, I would
not know how to write a batch that would have the effect I need in
this particular situation of mine.

But... this last part suggests that it did not work without the extra
explorer window.
Also, elsewhere you wrote:
"I finally had to resort to a hack, where an accompanying action is that
an instance of explorer is opened up in that folder, and it's that act
which changes path so that the pif/bat knows where to run from."

So I am confused.
I don't see a reason why the extra explorer window would be needed to
change directory.
Anyway on my system the simple cd "%1%" suffices.
(I.o.w.: on my system I could have 2 items in my context menu, e.g.:
RunPIF and RunPIF X, providing for a choice: with or without Explorer.)

Anyhow, that's a clever and nice idea to have uniformally named batch
files in multiple directories and to create a contextmenu item for
folders to enable starting them from toolbars. I like!
Now, here is a more standard situation. Some CLI programs. Let me talk
about a type of case that doesn't even bring in the extra complexity
of configuring sendto bats. It's where I just want to run some CLI
program straight out, from a simple bat written for it containing
particular parameters that I've chosen. xBAR was a recent example for
me. It has
a variety of disparate actions it can do. In its folder, I put
separate bats for each set of actions I might want to have executed.

But I cannot launch those bats from my toolbar.

It would be nice if I knew what contextual command could be configured
for this sort of targeted object, where there would be a CD to that
object's path, so that it would be able to run.

But would not setting the working directory for the PIF's suffice?
I've long wanted to resolve a better way to deal
with HelpDeco decompiles. Your StartIn sounds like it might be just
the ticket for solving that problem.

I wouldn't mind if it would be useful in some way afterall. :)
Thank you, Sietse...

yvw
 
S

Sietse Fliege

omega said:
What would be useful is to go into the related subject: writing a
batch file, one that shall be used contextually (from sendto or from
explorer context menu), which can retrieve the path of the targeted
object and do CD to that locale for its actions. (Might be impossible
from the toolbar launching, but at least one can get it set up for
launching from a file- manager context.) I once poked around with
some batch utilities towards this end, but had not persisted with the
project long enough to get things properly worked out. And since it
is such a fundamental need, have since then felt a bit incompetent.

I tried the utility basepath.exe from Prof. Timo Salmi's tsbat.zip
ftp://garbo.uwasa.fi/pc/link/tsbat.zip
It didn't work in WinXP, but on my Win95 box it worked fine.
(I only tried the SendTo method.)

Basepath returns the path into the environment variable named basepath.
See also item 39 in 1BATFAQ.TXT from tsbat.zip

Quite straightforward, I found. Like e.g. :
Basepath.exe %1%
cd %basepath%
 
M

Mark R. Blain

I tried the utility basepath.exe from Prof. Timo Salmi's tsbat.zip
ftp://garbo.uwasa.fi/pc/link/tsbat.zip
It didn't work in WinXP, but on my Win95 box it worked fine.
(I only tried the SendTo method.)

Basepath returns the path into the environment variable named basepath.
See also item 39 in 1BATFAQ.TXT from tsbat.zip

Quite straightforward, I found. Like e.g. :
Basepath.exe %1%
cd %basepath%

In WinNT, Win2K, and WinXP you can replace that with
cd /d %~dp1
No need for basepath.exe. The contents of %1 must include quotes.
The /d allows you to change drives and directories at the same time.
My thanks to Tim O'Brien's wonderful book "Windows NT Shell
Scripting", Timo Salmi's stuff at
<http://www.uwasa.fi/~ts/http/http2.html#cmdscript> and the folks in
<(and
<for the %~dp1 thing!
This is getting off-topic here, but it's very much on-topic there.
Come and visit.
 
S

Sietse Fliege

Sietse said:
Anyway on my system the simple cd "%1%" suffices.
cd %1 of course :-(*)

Well, I'd overseen that it's more complicated than that.
The current dir may not be on the same drive as the target dir, which
would mean changing drives first.
 
S

Sietse Fliege

Sietse said:
Basepath returns the path into the environment variable named
basepath. See also item 39 in 1BATFAQ.TXT from tsbat.zip

Quite straightforward, I found. Like e.g. :
Basepath.exe %1%

Basepath.exe %1 of course :-(*)
cd %basepath%

Mark R. Blain reminded me that in order to make it work if the file is
not on the current drive, you have to change drives first!

So not as straight forward as I thought.
Frankly, at the moment I can't think of something simple to accomplish
this.
 
S

Sietse Fliege

In WinNT, Win2K, and WinXP you can replace that with
cd /d %~dp1

I had seen %~dp1 in FOR statements.
Didn't know you can use it like this. Thanks!
No need for basepath.exe. The contents of %1 must include quotes.
The /d allows you to change drives and directories at the same time.

OOPS I'd overseen that changing drives may also come into play. :-(*)
 
S

Sietse Fliege

Sietse said:
Mark R. Blain reminded me that in order to make it work if the file is
not on the current drive, you have to change drives first!

So not as straight forward as I thought.
Frankly, at the moment I can't think of something simple to accomplish
this.

It looks like this works:

basepath.exe %1
%basepath%.\ :: make the target drive active, if necessary
cd %basepath%

Thanks to Frank-Peter Schultze
<http://groups.google.com/[email protected]>
 
O

omega

Sietse Fliege said:
With all this complete info I could exactly reproduce your situation on
my Win95B box.

Sietse, it's very kind of you to look into my config....
I don't see a reason why the extra explorer window would be needed to
change directory.
Anyway on my system the simple cd "%1%" suffices.
(I.o.w.: on my system I could have 2 items in my context menu, e.g.:
RunPIF and RunPIF X, providing for a choice: with or without Explorer.)

No go on my system. My output window below from the test. (I'm assuming
you can bear with my non-default prompt setting, instead of my changing
for this post. I've a "set prompt=$P\$_$_okay:")

okay:
H:\2004\0927\test\

okay: cd "D:\EDZ\NPADS\TXT\TT\SDI\BDV"

H:\2004\0927\test\

okay: start run.pif
Cannot find file 'run.pif' (or one of its components). Check
to ensure the path and filename are correct and that all required
libraries are available.

H:\2004\0927\test\

okay:
H:\2004\0927\test\


[....]
The other subject:
But would not setting the working directory for the PIF's suffice?

But then I would no longer get to have local only. I could equally change
the bats involved to absolute path. But same loss there. And, the other
thing, putting a copy of a CLI executable in path. Well, I do that only
for those programs where I've arrived at the conclusion that there is
reasonable likelihood that I will take up routine use, and have a fair
chance of remembering their existence. I don't want to do the copy to
local path for every last inbound CLI program I might be testing.

I see you have some other ideas, as with the basepath program. It looks
familiar. I'm going to reread your notes, run some tests, and check into
what happens there...
 
O

omega

Sietse Fliege said:
Basepath.exe %1 of course :-(*)

Hypocrite! =)
Mark R. Blain reminded me that in order to make it work if the file is
not on the current drive, you have to change drives first!

That week or so where I'd started looking into this subject, I do remember
that coming up. I read about some ways to do the change drive thing, but
the whole thing was pretty involved. As I'd first noted, had put the matter
in abeyance instead of getting it sorted out. :(
So not as straight forward as I thought.
Frankly, at the moment I can't think of something simple to accomplish
this.

I recall starting to come across some very long batch scripts, which had
to resort to writing temp files and so forth. Long and semi-incomprehensible
batch scripts are ugly in my eyes. And I started wondering if perhaps - for
the matter of my context-menu entries - it might be in the realm of a VBS
script that I'd find a shorter, neater solution.

(So then I started reading docs on VBS... until that too got shelved to
abeyance... while my point-click GUI toys took back the forefront of my
leisure attentions. Plus, there were some good HBO actions flicks playing
that week, and eh yknow...)
 
O

omega

Sietse Fliege said:
%1.\ :: make the target drive active, if necessary
cd %1

YES! Success!! Exactly what had been eluding me sooo long.

It's terrific. And now my config is finally enabled, without the broken
limbs it had.

Very grateful! ( I owes u bigtime. :cool: )
 
S

Sietse Fliege

omega said:
YES! Success!! Exactly what had been eluding me sooo long.

It's terrific. And now my config is finally enabled, without the
broken limbs it had.

Very grateful! ( I owes u bigtime. :cool: )

YVW Glad I could do something back for the great help you provide.

B.t.w. in the other situation (batch files to be used contextually),
basepath.exe %1
%basepath%.\ :: make the target drive active, if necessary
cd %basepath%
Does this solution now also work out for you?

And there was this other situation:
It's where I just want to run some CLI program
straight out, from a simple bat written for it containing particular
parameters that I've chosen.

Does change drives, then cd (maybe using basepath) at some place in the
config also help there?
 
M

Mike Henley

Chaos Master said:
Mike Henley writes within:

It creates a UNIX 'shell' in your system, creating shortcuts to 'Cygwin BASH'.
Click on the shortcut, you'll soon have a prompt '$'.

Then you can give UNIX commands on the prompt.

So I just need to learn Unix commands? is that it?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top