When working at the Caché command prompt I sometimes want to run an operating system command on the server host. By prefixing my command line with ! or $ I can do this with ease. The following examples are from 2017.1 on Windows, but the feature is available on all versions and platforms:

USER>!dir



Volume in drive C has no label.

Volume Serial Number is 2EF9-50B3



Directory of c:\intersystems\ens171\mgr\user



12/06/2017 12:41 <DIR> .

12/06/2017 12:41 <DIR> ..

02/02/2017 18:05 11,534,336 CACHE.DAT

16/06/2017 12:05 36 cache.lck

07/11/2016 17:18 <DIR> stream

2 File(s) 11,534,372 bytes

3 Dir(s) 83,540,684,800 bytes free

USER>$dir



Volume in drive C has no label.

Volume Serial Number is 2EF9-50B3



Directory of c:\intersystems\ens171\mgr\user



12/06/2017 12:41 <DIR> .

12/06/2017 12:41 <DIR> ..

02/02/2017 18:05 11,534,336 CACHE.DAT

16/06/2017 12:05 36 cache.lck

07/11/2016 17:18 <DIR> stream

2 File(s) 11,534,372 bytes

3 Dir(s) 83,075,710,976 bytes free

USER>



If I need to issue more than one command I can almost get myself an interactive shell:



USER>!



c:\intersystems\ens171\mgr\user\> dir

Volume in drive C has no label.

Volume Serial Number is 2EF9-50B3



Directory of c:\intersystems\ens171\mgr\user



12/06/2017 12:41 <DIR> .

12/06/2017 12:41 <DIR> ..

02/02/2017 18:05 11,534,336 CACHE.DAT

16/06/2017 12:05 36 cache.lck

07/11/2016 17:18 <DIR> stream

2 File(s) 11,534,372 bytes

3 Dir(s) 83,075,211,264 bytes free

c:\intersystems\ens171\mgr\user\>

c:\intersystems\ens171\mgr\user\> date

The current date is: 23/06/2017

Enter the new date: (dd-mm-yy)

c:\intersystems\ens171\mgr\user\>

c:\intersystems\ens171\mgr\user\> exit

USER>

I wrote "almost" because in the example above the 'date' command prompted me to enter a new date but didn't wait for my keystrokes. It behaved as though I had immediately pressed Enter.

Still, I find it a useful feature.

To use it you will need the %System_Callout:USE privilege.

More documentation here.