Pete's Windows, Office, VB & SQL Blog

Problems I have solved (or not) and good ideas I've found

Posts Tagged ‘cmd files

Scheduled tasks created by schtasks do not run – “could not start”

leave a comment »

The reason for this is quite simple, but once again the information on the web is misleading.  The schtasks parameter concerned is /tr, this tells the scheduler what to run.  The value must be enclosed in quotes inside the schedule job file if the path name contains spaces.  Therefore the string that must be delivered is

“C:\Program Files\Scheduled\Program.exe”  -Param=P

To include the double quote character in the string use \” (not ^”) so the /tr parameter looks like:

/tr “\”C:\Program Files\Scheduled\Program.exe\” -Param=P”

full details from Microsoft here, see the Workaround tab

Written by fisherpeter

2010 September 2 at 20:09

how to get rid of those annoying 3 encoding characters written at the start of a text file

leave a comment »

If your text file looks like

TEXT

or similar the you have generated encoding characters, to generate the file without them use

Dim TextString As String = “TEXT”
My .Computer.FileSystem.WriteAllText(“C:\TEXT.TXT” , TextString, False, System.Text.Encoding.ASCII)

the Default option will encode in ANSI, but still provide the encoding string.

Written by fisherpeter

2010 August 11 at 10:56

Follow

Get every new post delivered to your Inbox.