Brubaker Posted June 13, 2008 Share Posted June 13, 2008 I'm trying to script Windows Sysinternals secure delete utility, Sdelete. It works fine so long as the target filename does not contain spaces, but I'm unable to find a way to deal with names that contain spaces. For example: Run ("Sdelete -p 5 filename.txt") works fine. Run ("Sdelete -p 5 file name.txt") does not work. When running Sdelete from a command prompt, I place the filename in quotes: Sdelete -p 5 "file name.txt" but I haven't found a way to pass the file name (with space) variable in a script. How's it done? Link to comment Share on other sites More sharing options...
amokoura Posted June 13, 2008 Share Posted June 13, 2008 (edited) Run("Sdelete -p 5 ""file name.txt""") Edited June 13, 2008 by amokoura Link to comment Share on other sites More sharing options...
Brubaker Posted June 13, 2008 Author Share Posted June 13, 2008 That works perfectly! Thanks. Link to comment Share on other sites More sharing options...
PsaltyDS Posted June 13, 2008 Share Posted June 13, 2008 Run("Sdelete -p 5 ""file name.txt""") Proper quoting is good. Another useful trick is to convert it to 8.3 "short" format first: $sFilePath = "C:\Documents And Settings\" & @UserName & "\Application Data\" $sShortPath = FileGetShortName($sFilePath) MsgBox(64, "Result", "Long path = " & $sFilePath & @CRLF & "Short path = " & $sShortPath) Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law Link to comment Share on other sites More sharing options...
BVKevCo Posted June 27, 2008 Share Posted June 27, 2008 Hi, How would one go about using quotes with variables? I have tried several combinations and nothing is working. I have this, but it doesn't work, because there aren't quotes around the variable. Run(GUICtrlRead($IDIEXE_Input)) Thanks, Kevin Link to comment Share on other sites More sharing options...
aslani Posted June 27, 2008 Share Posted June 27, 2008 (edited) Hi, How would one go about using quotes with variables? I have tried several combinations and nothing is working. I have this, but it doesn't work, because there aren't quotes around the variable. Run(GUICtrlRead($IDIEXE_Input)) Thanks, Kevin This one works for me. Run("" & GUICtrlRead("" & $IDIEXE_Input)) I don't know any other way. Edited June 27, 2008 by aslani [font="Georgia"]Chances are, I'm wrong.[/font]HotKey trouble?Stringregexp GuideAutoIT Current Version Link to comment Share on other sites More sharing options...
monoceres Posted June 27, 2008 Share Posted June 27, 2008 Here's some examples on using quotes: $string = """This string has double quotes""" $string2='"'&"This string too"&'"' $string3='""""""Lots of quotes :D""""""' $string4="""this string has many ' ' ' ' and a lot of """"""" MsgBox(0,"",$string&@CRLF&$string2&@CRLF&$string3&@CRLF&$string4) Broken link? PM me and I'll send you the file! Link to comment Share on other sites More sharing options...
PsaltyDS Posted June 27, 2008 Share Posted June 27, 2008 Hi, How would one go about using quotes with variables? I have tried several combinations and nothing is working. I have this, but it doesn't work, because there aren't quotes around the variable. Run(GUICtrlRead($IDIEXE_Input)) Thanks, Kevin If you want to Run() the string read from the control ID in $IDIEXE_Input, after putting quotes around it, then it would be: Run('"' & GuiCtrlRead($IDIEXE) & '"') Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law Link to comment Share on other sites More sharing options...
BVKevCo Posted June 27, 2008 Share Posted June 27, 2008 Thank you!! This works: Run('"' & GuiCtrlRead($IDIEXE) & '"') 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