Jump to content
Sign in to follow this  
jeronimogarcia

$ replacement

Recommended Posts

jeronimogarcia

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

Share this post


Link to post
Share on other sites
jvanegmond

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$''")'

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×