When trying out the system command you will realize that
system dir
actually works but others shell commands like “md” don’t.
To get those working you have to also call the Windows command interpreter “cmd”
Therefor a correct syntax for creating a new directory via the system command in TOUCH would be:
system cmd /c md $newFolder
The /c is required so that the Windows process terminates after being done, otherwise TOUCH will wait for ever for an answer.
Update… just found that the ‘command’ command is gone in windows 7 - just when you find you need DOS! I notice tht there are still problems in paths with spaces. Is that a windows or a touch problem? my temporary work-around is to put a shortcut in the root directory of the drive - not elegant by any means…
the stuff below might still be useful to XP users.
R.
Okay, now I have it.
when using the system command…
if you need to type a file name with a space in it, one way is to use the old MSDOS 8.3 file naming trick.
you put the first six letters from the name followed by ~1 then the dot and extension.
to get a list of files in the current directory showing their shortened version file names,
type DIR /x to show the shortened file names
okay, here’s a trick to get the full path in short form without spaces.
open the winXP ‘cmd’ program (type cmd at the run prompt in winxp)
in windows open the window of the directry you want.
type cd in the command window then drag the path name from the directory window into the command window, then press enter.
now you’ll see the file path in long format
type ‘command’ (without quotes) and hit return/enter
now you’ll have the old DOS command shell open with the full path name in shortened form
right click in the command window and select ‘mark’ form the menu that pops up, then drag across the path text to copy it.
to handle spaces, put " around your arguments. e.g.
system ls \"C:/Program Files\"
I’ve filled in the help for the system command and added instructions for handling arguments with spaces. they will be in the next build. the wiki has also been updated.
… all throw errors or launch an empty command window.
I’m trying this in relation to the Pachube discussion elsewhere in the forum.
I’m trying to use cURL [url]http://curl.haxx.se/download.html[/url] to act as an alternative to the web DAT but I think touch is getting jealous.
It was simple single quotes all along (time to update the system command help text again!).
I made a directory in my c:\Windows directory called ‘_user_added_programs’. I put all little programs that don’t have installers, cURL.exe for example. Because this location is inside the default path, the program will run from the command line without having to type the complete path to it.
then, we can pipe the result directly into touch using touch’s redirect operator ‘>’
system 'curl http://www.ndbc.noaa.gov/data/realtime2/55015.dart'>DAT:curl_direct
creates a DAT called curl_direct and fills it with the output of the cURL command.
(If the DAT already exists, you don’t need the DAT: you’d just put >curl_direct.)
The disadvantage of doing it this way is that the timeline freezes while this all happens. If that’s a problem, then getting cURL to save the data to a file and loading it into a file DAT is better.
I’ll attach a .toe once I clean it up a bit (remove my previous script attempts that freeze my whole system! Save everything before testing a script with system command in it!) (@@)
Here’s a .toe that grabs sets of ocean buoy data showing wave heights in m (in terms of water column height). I think they update every couple of hours. Those working with Pachube should be able to modify it easily.
you need cURL.exe somewhere in your c:\Windows directory or in the default path someplace.