Sign in to follow this  
Followers 0
gcue

having trouble with quotes on this one

21 posts in this topic

im having trouble getting this command to work.. its definitely a quotes issue

trying to get quotes right around the "shutdown...... /st" and quotes around the $Guictrlread($message)

Run(@ComSpec & ' /c schtasks /create /s \\' & $asset & ' /Ru SYSTEM /sc once /tn Dashboard-Restart /tr "shutdown -r -f -t 300 -c ' & '"' & GUICtrlRead($message) & '"' & '" /st ' & GUICtrlRead($time), "", @SW_HIDE)

thanks

Share this post


Link to post
Share on other sites



im having trouble getting this command to work.. its definitely a quotes issue

trying to get quotes right around the "shutdown...... /st" and quotes around the $Guictrlread($message)

Run(@ComSpec & ' /c schtasks /create /s \\' & $asset & ' /Ru SYSTEM /sc once /tn Dashboard-Restart /tr "shutdown -r -f -t 300 -c ' & '"' & GUICtrlRead($message) & '"' & '" /st ' & GUICtrlRead($time), "", @SW_HIDE)oÝ÷ ÚØZK?ªê-y«­¢+ØÀÌØíÍ=ÕÑÁÕÑQÍÐôÌäì½Í¡Ñͭ̽ÉѽÌÀäÈìÀäÈìÌäìµÀìÀÌØíÍÍеÀìÌäì½IÔMeMQ4½Í½¹½Ñ¸Í¡½ÉµIÍÑÉнÑÈÅÕ½ÐíÍ¡ÕѽݸµÈµµÐÌÀÀµÌäìµÀìÌäìÅÕ½ÐìÌäìµÀìU%
ÑɱI ÀÌØíµÍͤµÀìÌäìÅÕ½ÐìÌäìµÀìÌäìÅÕ½Ðì½ÍÐÌäìµÀìU%
ÑɱI ÀÌØíÑ¥µ

My first try would be verify this. Check this using ConsoleRead($sOutputTest) or MsgBox(0, 0, $sOutputTest).

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

i think you have 2 closing doublequotes: GUICtrlRead($message) & '"' & '" /st '

Edited by Jos

Visit the SciTE4AutoIt3 Download page for the latest versions  - Beta files                                How to post scriptsource        Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

i tried that.. looks ok

My first try would be verify this. Check this using ConsoleRead($sOutputTest) or MsgBox(0, 0, $sOutputTest).

Share this post


Link to post
Share on other sites

i tried taking them off but it doesnt work...

i need that second " close because of the one i start before "shutdown

i think you have 2 closing doublequotes: GUICtrlRead($message) & '"' & '" /st '

Share this post


Link to post
Share on other sites

yep

heres the command that works

schtasks /create /s \\d0075931 /Ru SYSTEM /sc once /tn dashboard-restart /tr "shutdown -r -f -t 9999 -c "eh"" /st 07:00:00

Share this post


Link to post
Share on other sites

yep

heres the command that works

schtasks /create /s \\d0075931 /Ru SYSTEM /sc once /tn dashboard-restart /tr "shutdown -r -f -t 9999 -c "eh"" /st 07:00:00

If that line works from the command line (including the doubled double quote) then it should run fine like this:
$sExtCmd = 'schtasks /create /s \\' & $asset & ' /Ru SYSTEM /sc once /tn dashboard-restart ' & _
        '/tr "shutdown -r -f -t 9999 -c "eh"" /st 07:00:00'
Run($sExtCmd, @TempDir)

:)


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

Share this post


Link to post
Share on other sites

including both guictrlreads?

guictrlread($message) and guictrlread($time)

thats where im coming acrross probs

Share this post


Link to post
Share on other sites

yep

heres the command that works

schtasks /create /s \\d0075931 /Ru SYSTEM /sc once /tn dashboard-restart /tr "shutdown -r -f -t 9999 -c "eh"" /st 07:00:00

what about using single-quotes around GUICtrlRead($message) ?

Well, first try the PsaltyDS suggestion.

Share this post


Link to post
Share on other sites

Just tried this version which worked for me:

Run(@ComSpec & ' /c schtasks /create /Ru SYSTEM /sc once /tn dashboard-restart /tr "shutdown -r -f -t 9999 -c "eh"" /st 07:00:00', "", @SW_HIDE)

It creates the same task when run from the CMD line. But both results have the doublequotes missing around eh when displaying it in the taskscheduler.

I cannot test doing this for a networked system.

Jos


Visit the SciTE4AutoIt3 Download page for the latest versions  - Beta files                                How to post scriptsource        Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

including both guictrlreads?

guictrlread($message) and guictrlread($time)

thats where im coming acrross probs

Sorry, forgot that part:
$sMsg = GUICtrlRead($message)
$sTime = GUICtrlRead($time)
$sExtCmd = 'schtasks /create /s \\' & $asset & ' /Ru SYSTEM /sc once /tn dashboard-restart ' & _
        '/tr "shutdown -r -f -t 9999 -c "' & $sMsg & '"" /st ' & GUICtrlRead($time)
ConsoleWrite("Debug: $sMsg = " & $sMsg & @LF)
ConsoleWrite("Debug: $sTime = " & $sTime & @LF)
ConsoleWrite("Debug: $sExtCmd = " & $sExtCmd & @LF)
Run($sExtCmd, @TempDir)

Included a debug display of the values for troubleshooting.

:)


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

Share this post


Link to post
Share on other sites

no dice psalty =/

i like the idea of seperating everything tho

Share this post


Link to post
Share on other sites

#14 ·  Posted (edited)

no dice psalty =/

That's not a helpful description for further troubleshooting... What happened when you tried it? Post the console output.

:)

Edited by PsaltyDS

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

Share this post


Link to post
Share on other sites

hehe sorry.. how do i get the console output? never knew how to do that

i tried console read.. but not sure how to output

Share this post


Link to post
Share on other sites

hehe sorry.. how do i get the console output? never knew how to do that

i tried console read.. but not sure how to output

Run it from SciTE and ConsoleWrite() writes to the console pane at the bottom of the SciTE window.

Or, you could change the ConsoleWrite() functions to MsgBox() or even _FileWriteLog() to collect the debug info.

:)


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

Share this post


Link to post
Share on other sites

#17 ·  Posted (edited)

ooooo neaat!

Debug: $sMsg = I am restarting your machine because ____. Please call x___ for questions.

Debug: $sTime = 10:00:00

Debug: $sExtCmd = schtasks /create /s \\d0091119 /Ru SYSTEM /sc once /tn dashboard-restart /tr "shutdown -r -f -t 300 -c "I am restarting your machine because ____. Please call x___ for questions."" /st 10:00:00

i figured out that it doesnt like the spacing in the $sMsg.. bc if i take out the spaces it works...

hmm can i add the spaces at the end of the process??? or what else can i try?

thanks for your help with this fellas.

Edited by gcue

Share this post


Link to post
Share on other sites

ooooo neaat!

Debug: $sMsg = I am restarting your machine because ____. Please call x___ for questions.

Debug: $sTime = 10:00:00

Debug: $sExtCmd = schtasks /create /s \\d0091119 /Ru SYSTEM /sc once /tn dashboard-restart /tr "shutdown -r -f -t 300 -c "I am restarting your machine because ____. Please call x___ for questions."" /st 10:00:00

i figured out that it doesnt like the spacing in the $sMsg.. bc if i take out the spaces it works...

hmm can i add the spaces at the end of the process??? or what else can i try?

thanks for your help with this fellas.

I get it now... the shell command line for schtasks cannot nest literal quotes for the contained commandline for shutdown. Try escaping the literal quotes with '\"' like this:
$sMsg = GUICtrlRead($message)
$sTime = GUICtrlRead($time)
$sExtCmd = 'schtasks /create /s \\' & $asset & ' /Ru SYSTEM /sc once /tn dashboard-restart ' & _
        '/tr "shutdown -r -f -t 9999 -c \"' & $sMsg & '\"" /st ' & $sTime
ConsoleWrite("Debug: $sMsg = " & $sMsg & @LF)
ConsoleWrite("Debug: $sTime = " & $sTime & @LF)
ConsoleWrite("Debug: $sExtCmd = " & $sExtCmd & @LF)
Run($sExtCmd, @TempDir)

:)


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

Share this post


Link to post
Share on other sites

ok is there anything penguins cant do other than fly?

errrrrrr can you fly?

thanks bud!!!!!!!!

Share this post


Link to post
Share on other sites

ok is there anything penguins cant do other than fly?

errrrrrr can you fly?

That's a terribly insensitive question! I can't believe you asked that!

No <sniffle>, penguins can't fly... go ahead and rub it in why don't you?

:)


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

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  
Followers 0