Page 1 of 1

Scripting Command: attrib

Posted: 11 Feb 2009 19:54
by fishgod
Any possibility to write attributes through a script?

There is the possibility to use the "run"-command with the windows-attrib-command, but it produces nasty terminal-windows.

I need to change the attribute to create a folder with a custom icon through a script. (folder needs attrib +r or +s to parse the desktop.ini, and the desktop.ini gets +h)

Re: Scripting Command: attrib

Posted: 11 Feb 2009 19:58
by admin
I made a note.

Re: Scripting Command: attrib

Posted: 29 Mar 2011 16:42
by tiago
Bumping on this.
As far as I can see there's no such a thing yet available for us to play with. Is it time?

Re: Scripting Command: attrib

Posted: 29 Mar 2011 19:25
by admin
tiago wrote:Bumping on this.
As far as I can see there's no such a thing yet available for us to play with. Is it time?
No.

Re: Scripting Command: attrib

Posted: 29 Mar 2011 20:54
by Stefan
We can use every dos command by using smtg like this:
run "%comspec% /c attrib +s c:\temp\file name.ext";
This will show an DOS-Box for an second.

To hide the DOS-Box (terminal window) there are several small stand alone tools
like HideDos.exe or Autohotkey or AutoIt or VBS scripts. (But i don't know right now how to hide internal commands like attrib)


But we can use an VBScript like this:

comspec.vbs

Code: Select all

If WScript.Arguments.Count <> 1 Then Wscript.Quit
command = WScript.Arguments(0)
CreateObject("WScript.Shell").Run "%comspec% /c " & chr(34) & command & chr(34), 0, True
and use this like:
run "<xypath>\comspec.vbs" "attrib +r -s -h c:\temp\name.ext";

This will not show any window.

(If the default action of vbscript on your box is show in notepadinstead of executing use
run "cScript <xypath>\comspec.vbs" "attrib +r -s -h c:\temp\name.ext";
-

Or simple create an shortcut to windows\cmd.exe into your XYplorer folder: cmd.exe.lnk
then modify the link property to run minimized
and use this as:
run "<xypath>\cmd.exe.lnk /c attrib +s +h c:\temp\file name.ext";

This will only show an taskbar icon for an second.

Re: Scripting Command: attrib

Posted: 02 Apr 2011 17:19
by tiago
Thank you very much Stefan.