Simplify iT Posted April 14, 2006 Share Posted April 14, 2006 Hi All, I am very new to Autoit and thought i would ask the script masters for some help. What i am looking to do is be able to delete the current disk forum name for drive f: I have attempted to do this with the command line "label.exe" tool, however it requires user interaction and i want to make this hands free. So ideally i need a script that i can add the drive like delvol.au3 d (to delete the volume name from drive d:) Can anyone tell me if this can be done and how i might do it? Cheers, Darren Link to comment Share on other sites More sharing options...
Uten Posted April 14, 2006 Share Posted April 14, 2006 Do you want to detache (as in hide) the volume or do you want to wipe it? Is it a removable volume? Please keep your sig. small! Use the help file. Search the forum. Then ask unresolved questions :) Script plugin demo, Simple Trace udf, TrayMenuEx udf, IOChatter demo, freebasic multithreaded dll sample, PostMessage, Aspell, Code profiling Link to comment Share on other sites More sharing options...
CyberSlug Posted April 14, 2006 Share Posted April 14, 2006 (edited) Might work:#include <Process.au3> _RunDOS( "label F: TheNewName" )EDIT: Wait, I see what you mean about requiring interaction when the new label is blank!You could use the StdinWrite function (requires beta version of AutoIt).#include <Constants.au3> $pid = Run("label.exe d:", "", @SW_HIDE, $STDIN_CHILD) StdinWrite($pid, @CRLF & "y" & @CRLF);Enter, Yes, EnterTo specify drive letter on command line#include <Constants.au3> If $CmdLine[0] = 0 Then Exit $driveLetter = $CmdLine[1] $pid = Run("label.exe " & $driveLetter, "", @SW_HIDE, $STDIN_CHILD) StdinWrite($pid, @CRLF & "y" & @CRLF);Enter, Yes, EnterHere's an alternative method seems to work on Windows XP (also requires beta version:$driveLetter = "D:" $oShell = ObjCreate("shell.application") $oShell.NameSpace($driveLetter).Self.Name = ""If you want to pass the drive letter on the command line, then you could replace the first line with:$driveLetter = ""If $CmdLine[0] > 0 Then $driveLetter = $CmdLine[1] Edited April 14, 2006 by CyberSlug Use Mozilla | Take a look at My Disorganized AutoIt stuff | Very very old: AutoBuilder 11 Jan 2005 prototype I need to update my sig! Link to comment Share on other sites More sharing options...
NightGaunt Posted April 14, 2006 Share Posted April 14, 2006 $var = "F:" DriveSetLabel ( $var, "" ) That will Empty the label; is that it? "I have discovered that all human evil comes from this, man's being unable to sit still in a room. " - Blaise Pascal Link to comment Share on other sites More sharing options...
CyberSlug Posted April 14, 2006 Share Posted April 14, 2006 $var = "F:" DriveSetLabel ( $var, "" ) That will Empty the label; is that it? Sure, if you want to do it the easy way and look in the help file :"> Thanks Use Mozilla | Take a look at My Disorganized AutoIt stuff | Very very old: AutoBuilder 11 Jan 2005 prototype I need to update my sig! Link to comment Share on other sites More sharing options...
sykes Posted April 14, 2006 Share Posted April 14, 2006 If you want to change the label using a command line switch use the following: If $cmdline[0] <> "" Then If $cmdline[0] = 2 Then $drv = $cmdline[1] $label = $cmdline[2] DriveSetLabel($drv & ":", $label) EndIf EndIf usage is: delvol [drive letter] [label name] Examples: delvol c Main changes the label for drive c to "Main" delvol f "" removes the label for drive f hope this helps We have enough youth. How about a fountain of SMART? Link to comment Share on other sites More sharing options...
Simplify iT Posted April 14, 2006 Author Share Posted April 14, 2006 $var = "F:" DriveSetLabel ( $var, "" ) That will Empty the label; is that it?thats exactly what i am looking for - thanks so much! Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now