command line app fo changing file attributes

  • Thread starter Thread starter Daniel Kirsch
  • Start date Start date
D

Daniel Kirsch

Hi,
I want to change file attributes with a command line tool (no window
should be visible). I'm especially interested in changing the writable flag.

Maybe there is an easy solution using a build in OS method?

Thanks
Daniel
 
Il 19/03/2004 9.58, Daniel Kirsch scrisse:
Hi,
I want to change file attributes with a command line tool (no window
should be visible). I'm especially interested in changing the writable
flag.

Maybe there is an easy solution using a build in OS method?

Windows?

Attrib

bye
maxx
 
emmexx said:
Windows?
Yes

Attrib

But how to call it without opening a window? If called the CommandBox
flahes up.
And how do I just change the Writable flag?

Thanks
Daniel
 
I want to change file attributes with a command line tool (no window
should be visible). I'm especially interested in changing the writable flag.

Do you mean the DOS attrib command? As usual attrib /? in a dos
window will give info.


--

....malcolm

Malcolm Reeves BSc CEng MIEE MIRSE, Full Circuit Ltd, Chippenham, UK
([email protected], (e-mail address removed) or (e-mail address removed)).
Design Service for Analogue/Digital H/W & S/W Railway Signalling and Power
electronics. More details plus freeware, Win95/98 DUN and Pspice tips, see:

http://www.fullcircuit.com or http://www.fullcircuit.co.uk

NEW - Desktop ToDo/Reminder program (free)
 
Daniel said:
But how to call it without opening a window? If called the CommandBox
flahes up.

What do you mean you want a command line app, but you don't want a
commandbbox? Perhaps you want to enter a command in Start->Run? But if
so, why does it matter than a command window briefly flashes on the
screen? Please explain what you are really trying to do.

Also, what version of windows?
And how do I just change the Writable flag?

To make a file read-only:
attrib +r filename
To make a file read-write:
attrib -r filename

Type attrib to get help that explains this.

Terry
 
But how to call it without opening a window? If called the CommandBox
flahes up.
And how do I just change the Writable flag?
You need to create a batch file ( named, say, Myattrib.bat ), like so:

@ Echo off
Attrib %1 -r


Having done this, right click on it and open up the properties box.
Select the Program options and tick the box marked Close on exit.
Select Run Minimized in the Run options.

Whenever you need to run this batch file from within windows, go to
the start menu, select Run, and type Myattrib C:\path\filename - just
change the path and filename to suit.
The -r turns the read only flag off ( the writeable flag ), to
reinstate it you would have to change it to +r

Regards,
 
Terry said:
What do you mean you want a command line app, but you don't want a
commandbbox?

Well, I want to change file attributes from within my mozilla based xul
application. The build in mozilla methods doesn't work on windows
systems so I want to launch an external application, passing a path and
the attributes. That application should not show any windows, dialogs or
whatsoever.

When I say "command line app" I mean something like IrfanView offers for
its command line options. Sorry if this wasn't readable.

Also, what version of windows?

95,98,ME,NT,2000,XP

Thanks
Daniel
 
Daniel said:
Well, I want to change file attributes from within my mozilla based xul
application. The build in mozilla methods doesn't work on windows
systems so I want to launch an external application, passing a path and
the attributes. That application should not show any windows, dialogs or
whatsoever.


95,98,ME,NT,2000,XP

I see. I'm surprised you can't do this with the xul stuff, but I'm not
familiary with it. When you launch the external application, you can't
specify that it be hidden?

You could do this with scripting (jscript, vbscript), but if you're
targeting w95, you probably don't want to assume the presence of WSH.

All the command line tools that I know of that can do this are DOS
tools, so they will flash that command box when they run. Can't think
of anything offhand to do this, sorry. Of course, it would be a pretty
easy program to write if you are handy with VC++, Delphi, VB, or
similar.

Terry
 
Terry Orchard said:
I see. I'm surprised you can't do this with the xul stuff, but I'm not
familiary with it. When you launch the external application, you can't
specify that it be hidden?

You could do this with scripting (jscript, vbscript), but if you're
targeting w95, you probably don't want to assume the presence of WSH.

All the command line tools that I know of that can do this are DOS
tools, so they will flash that command box when they run. Can't think
of anything offhand to do this, sorry. Of course, it would be a pretty
easy program to write if you are handy with VC++, Delphi, VB, or
similar.

I know zero about what goes on with design of a XUL application. Still,
just in case of use, thought I'd mention a couple of invisible console
related things I've seen. The first, its WSH use, as Terry brought up.

...........................................................................

VBS to make a bat file (or program) run invisibly.

1. Create a file named invisible.vbs:

:: CreateObject("Wscript.Shell").Run """" & WScript.Arguments(0) & """", 0, False

2. Use invisible.vbs to run a program or a batch file:

:: wscript.exe "C:\Wherever\invisible.vbs" "C:\OtherPlace\MyBatchFile.bat"

http://ericphelps.com/batch/samples/invisible.txt
http://www.ericphelps.com/scripting/samples/Invisible/index.html
.............................................................................

.............................................................................

The other approach that I've found is a program named Run.exe:

| Run will allow execution of a console mode GUI program without its
| attendant console appearing. Run will create a hidden dos-box, that
| doesn't show up on the desktop OR on the taskbar. It will then execute
| your program, and pass along any extra arguments. This way, if you invoke
| it from the command line, it won't take over your current command window.
| And if you put it in a shortcut, you won't get that annoying dos-box.

http://www.neuro.gatech.edu/users/cwilson/cygutils/run/index.html

You pull out the run-native.exe file (54k) from that download. You rename
it to the program you want to run. This case: RunAttrib.exe. That gives you
the attrib exec doing its thing, but without invoking a console window.
.............................................................................
 
omega said:
I know zero about what goes on with design of a XUL application.

Doesn't matter :-)
There are methods to change attributes but they do not work on windows.
Bugs are reported for years now, but nobody seems to care :-(

http://www.neuro.gatech.edu/users/cwilson/cygutils/run/index.html

You pull out the run-native.exe file (54k) from that download. You rename
it to the program you want to run. This case: RunAttrib.exe. That gives you
the attrib exec doing its thing, but without invoking a console window.

Thanks a lot for that hint. It might be the solution of choice until I
find something better or the XPCOM bugs in Mozilla are fixed.

Daniel
 
Back
Top