Scripting Command: attrib

Features wanted...
Post Reply
fishgod
Posts: 231
Joined: 03 Feb 2008 00:40
Location: Sankt Augustin (near Bonn), Germany

Scripting Command: attrib

Post 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)
Operating System: Win10 x64 / Win11 x64 / almost allways newest XY-beta
totally XYscripting-addicted

admin
Site Admin
Posts: 65338
Joined: 22 May 2004 16:48
Location: Win8.1, Win10, Win11, all @100%
Contact:

Re: Scripting Command: attrib

Post by admin »

I made a note.

tiago
Posts: 589
Joined: 14 Feb 2011 21:41

Re: Scripting Command: attrib

Post 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?
Power-hungry user!!!

admin
Site Admin
Posts: 65338
Joined: 22 May 2004 16:48
Location: Win8.1, Win10, Win11, all @100%
Contact:

Re: Scripting Command: attrib

Post 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.

Stefan
Posts: 1360
Joined: 18 Nov 2008 21:47
Location: Europe

Re: Scripting Command: attrib

Post 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.

tiago
Posts: 589
Joined: 14 Feb 2011 21:41

Re: Scripting Command: attrib

Post by tiago »

Thank you very much Stefan.
Power-hungry user!!!

Post Reply