woody619 Posted September 29, 2014 Posted September 29, 2014 Hi, I'm creating a gui that will clear the contents of a specific folder remotely. I'm having trouble I believe because filedelete requires quotes around the path, but the way I've coded it (string?) also requires the quotes. How can I make this work? I'm just starting to script, so sorry if I'm not saying it correctly ;~ This works FileDelete ("\\is1127000\c$\Windows\System32\spool\PRINTERS\") ;~ Doens't work FileDelete (""\\" & $computerName & "\c$\Windows\System32\spool\PRINTERS\"") ;~ Also doens't work FileDelete ("\\" & $computerName & "\c$\Windows\System32\spool\PRINTERS\") ;~ Also doesn't work $Read= GUICtrlRead ($Input1) $start="(" $close=") $computerName = GUICtrlRead($Input1) FileDelete $start & "\\" & $computerName & "\c$\Windows\System32\spool\PRINTERS\" & $close
Solution MikahS Posted September 29, 2014 Solution Posted September 29, 2014 (edited) does this work for you? Local $computerName, $fDel $computerName = GUICtrlRead($Input1) ; must declare the variable and set it if your going to use it first $fDel = FileDelete ("\\is1127000\c$\Windows\System32\spool\PRINTERS\") If $fDel = 0 Then MsgBox(0, "", "first File delete didn't work because it didn't exist or didn't delete the file") EndIf $fDel = FileDelete ("\\" & $computerName & "\c$\Windows\System32\spool\PRINTERS\") If $fDel = 0 Then MsgBox(0, "", "second File delete didn't work because it didn't exist or didn't delete the file") EndIf $fDel = FileDelete ("\\" & $computerName & "\c$\Windows\System32\spool\PRINTERS\") If $fDel = 0 Then MsgBox(0, "", "third File delete didn't work because it didn't exist or didn't delete the file") EndIf $fDel = FileDelete ( "\\" & $computerName & "\c$\Windows\System32\spool\PRINTERS\" ) If $fDel = 0 Then MsgBox(0, "", "fourth File delete didn't work because it didn't exist or didn't delete the file") EndIf EDIT: Also, welcome to the AutoIt forum woody619 Edited September 29, 2014 by MikahS Snips & Scripts My Snips: graphCPUTemp ~ getENVvarsMy Scripts: Short-Order Encrypter - message and file encryption V1.6.1 ~ AuPad - Notepad written entirely in AutoIt V1.9.4 Feel free to use any of my code for your own use. Forum FAQ
woody619 Posted September 29, 2014 Author Posted September 29, 2014 That works! Looks like I tried that, but must've messed up something somewhere else that day. Thanks for your help ;~ Also doens't work FileDelete ("\\" & $computerName & "\c$\Windows\System32\spool\PRINTERS\")
MikahS Posted September 29, 2014 Posted September 29, 2014 That works! Looks like I tried that, but must've messed up something somewhere else that day. Thanks for your help ;~ Also doens't work FileDelete ("\\" & $computerName & "\c$\Windows\System32\spool\PRINTERS\") Glad to help Snips & Scripts My Snips: graphCPUTemp ~ getENVvarsMy Scripts: Short-Order Encrypter - message and file encryption V1.6.1 ~ AuPad - Notepad written entirely in AutoIt V1.9.4 Feel free to use any of my code for your own use. Forum FAQ
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