jeronimogarcia Posted January 21, 2010 Posted January 21, 2010 I am writting an autoit script to removed a hidden share and autoit is not letting me compile as I am getting a Badly formated variable or macro. The following is the line of code that breaks $VBS=$VBS&@CRLF&'Set colShares = objWMIService.ExecQuery("Select * from Win32_Share where name = 'Softgrid$'")' $VBS=$VBS&@CRLF&'Set colShares = objWMIService.ExecQuery("Select * from Win32_Share where name = 'Softgrid^ERROR Any help will be much appreciated. Thanks
jvanegmond Posted January 21, 2010 Posted January 21, 2010 If you had used [ autoit] tags the issue would be apparent. You forgot to escape some characters in the string. Your code: $VBS=$VBS&@CRLF&'Set colShares = objWMIService.ExecQuery("Select * from Win32_Share where name = 'Softgrid$'")' Corrected: $VBS=$VBS&@CRLF&'Set colShares = objWMIService.ExecQuery("Select * from Win32_Share where name = ''Softgrid$''")' github.com/jvanegmond
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