Jump to content
Sign in to follow this  
pokesquid808

having issues with line in script

Recommended Posts

pokesquid808

I'm writing a tool so that i can add network printers to computers within my companies domain. I know the command works because i was able to run it. I'm just trying to format it so autoit understands my command now. this is where my issue comes up.

RunWait(@Comspec & " /c for /F " & "tokens=1-6 delims=:. " & " %a in ('net view \\" & $PrintServerInput & "^| find " & "" ""&') do echo %a>>C:\RTCND\printlist.txt", @SystemDir, @SW_HIDE)

thats the line that is giving me issues.

this is the actual command if i'm doing it from a command prompt:

"for /F "tokens=1-6 delims=:. " %a in ('net view \\printserver ^| find " "') do echo %a>>C:\printlist.txt"

basically what this does is run a net view on the printer server and spits out the printer names to a text file. What i want to do is have auto it run the command create the txt file then populate a drop down table with all the printers on that print server. I know my problem is currently with all the quotes. i just can't seem to figure that out in my head. any help would be greatly appreciated. thanks

any help on populating the dropdown menu as well would be greatly appreciated as well! still trying to figure out how to get autoit to grab information from a text file and port it to a drop down menu.

thanks in advance

Share this post


Link to post
Share on other sites
MHz

RunWait('"' & @ComSpec & '" /c for /F "tokens=1-6 delims=:. " %a in (' & "'" & 'net view \\printserver ^| find " "' & "'" & ') do echo %a>>C:\printlist.txt')

Look at _FileReadToArray() and _TempFile() in the help file. You could also have a look at StdOutRead() so to avoid a temp file being used.

:D

Share this post


Link to post
Share on other sites
pokesquid808

thank you! i was looking at that line for hours and it kept compiling wrong :) all the quotes was confusing me lol.

much appreciated for the tips

Share this post


Link to post
Share on other sites
pokesquid808

sorry to bother again, but would this be what it should look like when i add in the variable after net view?

RunWait('"' & @ComSpec & '" /c for /F "tokens=1-6 delims=:. " %a in (' & "'" & 'net view \\' & $PrintServerInput & ' ^| find " "' & "'" & ') do echo %a>>C:\RTCND\printlist.txt', @SystemDIR, @SW_HIDE)

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  

×