Running raco on the Windows command line - windows

I am trying to make a stand-alone Racket executable on the Windows platform. How do I go about running raco from the windows command line? I'm not familiar with it.
If I use the documentation and enter the following command into cmd.exe:
raco exe --gui main.rkt
cmd.exe tells me:
'raco' is not recognized as an internal or external command, operable program or batch file.
Substituting in raco.exe tells me the same thing.
I also tried typing:
'C:\Program Files\Racket\raco.exe' exe --gui .\main.rkt
into powershell and it gave me an Unexpected token 'exe' in expression or statement error.

For the first problem: you need to add to windows' %PATH% (an environment variable) the path to the executable. For the second problem: check the correct syntax for the exe command, and/or the "--gui" modifier, they're being misused. For instance, try this after solving the first problem:
$ raco.exe exe main.rkt
The above will create an executable main.exe file.

Download and install Racket, which includes DrRacket. (Of course, you’re welcome to use your preferred text editor, but the tutorials will assume you’re using DrRacket.)
Update the PATH envi­ron­ment vari­able on your system to include the direc­tory that holds the racket appli­ca­tion. On Mac OS and Linux, this path will be some­thing like "/path/to/racket/bin". On Windows, it’ll be some­thing like "C:\Program Files\Racket". Then, from the terminal, you’ll be able to run racket and raco (see raco: Racket Command-Line Tools).
Windows users who haven’t altered your PATH before: don’t panic. To add the Racket command-line programs to your Windows 10 PATH, click the Windows search box, type the word path, and then click on Edit the system environment variables. Click on the Environment Variables button. In the top window, which contains your user variables, find Path and double-click it to open. Click the New button and either use the Browse button to select your Racket directory, or manually enter its path. Restart your Windows terminal (either the Command Prompt or PowerShell) and now racket and raco should work.

Related

installed program "cppcheck" but command "where cppcheck" (on windows command line) can't find anything

I downloaded and installed the program "cppcheck" (http://cppcheck.sourceforge.net/).
This program has both a GUI (which I can access without problems) and a command line interface.
However, when I go to the windows command prompt and type "where cppcheck", nothing can be found.
Am I crazy? Or is the command line interface for cppcheck only accessible on Unix systems?
Since I usually don't work with Windows, I didn't realise that the "where" command just looks in the current folder and child folders of the current folder. That's why I didn't get any results.
You have to add it in the environment variables since the cppcheck installer does not add it automatically. This way you can use the where command from any folder as it also checks the environment variables too.

how to configure emacs to start in a directory (windows)

I am running emacs 25.1 under Windows. It is a standalone binary, not running under cygwin
I have a .emacs file that works on both windows and linux. On Windows, however, the command:
(cd "c:/Users/xxx/git")
does not start emacs in that directory. The command works, because if I evaluate the buffer, it does go to that directory. It is as though something else is executing AFTER my script causing emacs to default to the stupid windows default, wherever the code is.
Any workaround to make emacs start in my desired directory?
Create a Windows shortcut to the Emacs executable, and use that to start Emacs. Create the shortcut by right-clicking the file runemacs.exe in folder bin and choosing Create shortcut.
Then fill out the Properties in the Shortcut tab:
Field Target has the command for starting Emacs: the location and name of the binary (executable) followed by whatever options you want and any file or directory that you want to start editing.
Field Start in has the directory that I want Emacs to start in.
For example:
Target: D:\Emacs-25.1\bin\runemacs.exe --debug-init "d:\usr\some-user-name\some-directory"
Start in: d:\usr\some-user-name\some-directory
Then just double-click your shortcut to start Emacs. Or single-click it, if you pin it to the Task Bar.
You can create as many such shortcuts as you want, either to the same Emacs executable (e.g. with different options or startup directories) or to different executables (e.g. different Emacs releases).
Try using emacs-startup-hook, which runs after processing the commandline and init.el.
(defun jpk/emacs-startup-hook ()
(cd "/some/path"))
(add-hook 'emacs-startup-hook #'jpk/emacs-startup-hook)
If that doesn't work, some package is setting the CWD, and you'll have to track it down.

How do you run programs in Windows terminal?

What is the windows equivalent to "./filename"
So for example I would usually compile by doing something like:
gcc -c homework1.c
gcc -o homework1 homework1.o
This would give me the executable names homework1
And for me to run the program, I would type: ( ./homework1 ) <-- ignore the parenthesis.
Usually I was write all my code in my schools Unix Shell thingy and I also compile it and run it there, but recently I think I took up all the disc space (because it says "disc quota exceeded").
Run cmd.exe
Go to where the program is example : cd C:\foder1\
Then type the program name with extension, for example : test1.exe or "test1.exe"
In windows (as in Linux) you can either run a program though a GUI interface or from a shell environment.
The GUI option is a program called Explorer, you navigate through the file system and double click executable files to run then. Executable typically have the extension '.exe' or '.bat', but there are others.
The shell environment in windows is called the 'command prompt', you can run it by going to the start menu and selecting 'run' or simply press the windows key and 'r' simultaneously. A box will popup, type 'cmd' (without the quotes) and hit enter - the command prompt should open. From there you can navigate the file system using commands like 'cd'. To run your executable type the name of the file (it should work with or without the '.exe').
A nice shortcut to open the command prompt already at a particular path, is to browse to the folder in Explorer, hold shift and then right-click the folder - the resulting context menu that pops up should have an option like 'open in command prompt'.

ActivePerl Installation on Windows operating system

I have installed ActivePerl on my Windows OS. I have followed below URL
procedure to install
ActivePerl Installation
After having done that, I have tried to run "perl -v " on the command line. But it reports the following error.
The system cannot execute the
specified program
What do I need to do to solve these issues?
I was facing a similar issue... but the thing was that I could execute the file by right clicking the file and opening it with perl command line interpreter.... but still the perl-v command would give the error... all I had to do was execute this command
set PATH=C:\Perl\bin;%PATH%
This solved the issue...
You need to make sure the directory where the Perl executable lives (it might be C:\perl\bin, but basically wherever you told ActiveState Perl to be installed) is in your PATH environmental variable (you can find the variable value by typing set PATH command on command line prompt in Windows).
If you're not sure where you installed Perl to (and can't find it in the default C:\perl\bin), you can find the directory by going to Start menu, finding ActiveState Perl folder, and right-clicking on "Perl Package Manager" icon, then pick "Properties" from the right-click menu. Properties window (in the "Shortcut" tab) will have a "Target" line showing the directory.
I was getting a similar error after installing ActiveState Perl on Windows 8 x64 bit edition and trying to invoke 'perl' at the command line.
'perl' is not recognized as an internal or external command, operable
program or batch file.
I remember selecting the option during installation to add the Perl directory to the system PATH environment, and after checking the system properties, it was indeed showing in the system PATH.
I tried installing 'Microsoft Visual C++ 2008 x86 and x64 redistributable setup' files as suggested by a few places but it still did not resolve the issue, until I tried some of the suggestions in this thread.
At the command prompt I entered:
set PATH
And surprisingly it did not list the Perl directories as being included in the PATH variables.
So to remedy that I entered this into the command prompt and hit enter:
set PATH=C:\Perl64\bin;C:\Perl64\site\bin;%PATH%
(The directory paths are for the 64 bit edition of Perl, adjust according to your installation) the %PATH% portion is important and ensures your existing settings are kept and not wiped out and overwritten when you set the PATH.
That fixed it and entering 'perl -v' into command prompt successfully replies your Perl version. If you had a PowerShell window open before setting the PATH variable, you will need to close it and re-open another instance of PowerShell.
I believe the original underlying issue was something to do with different PATH variables for 32-bit and 64-bit environments and possibly some internal Windows redirection that takes place automatically.
This doesn't sound like a problem with PATH - I would expect it to give the message 'perl' is not recognized as an internal or external command, operable program or batch file.
I have not seen this error message, but http://nirlevy.blogspot.com/2008/03/system-cannot-execute-specified-program.html makes some suggestion for related programs.
Or maybe ask on an Active State forum.
I had the same error. I was able to solve it by changing the order of the Perl64 entries in the PATH variable in the Environment Variables. I moved the C:\Perl64\bin to be before C:\Perl64\site\bin and it worked.
I had a similar error which was solved by adding the .pl extension to the script name, which I had forgotten to do.
I could not get it to work otherwise even with my Perl's location (C:\Apps\Perl\bin) verified as in %PATH%.
The problem lies in the installation directory.
The Perl PATH variable will be set to C:\Program Files\perl (depends on 32 or 64 bit of course), BUT, the default installation directory is C:\perl. This is kind of sneaky actually as you would assume the installer would be more intelligent about this, but it sets the environment variable to that directory no matter WHERE you install the damned thing.

Compiling Erlang code on Windows

I installed Erlang 13B and tried to follow the tutorials.
Every time I get to c(tut), I get an error instead of (ok, tut), so it seems like there are no modules installed. Can anyone point me in the right direction?
I've tried Emacs but I don't really know how to use it and haven't even got close to getting the Erlang mode working. For instance, where do I type:
(setq load-path (cons "C:/Program Files/erl5.6.2/lib/tools-<ToolsVer>/emacs"
load-path))
(setq erlang-root-dir "C:/Program Files/erl5.6.2")
(setq exec-path (cons "C:/Program Files/erl5.6.2/bin" exec-path))
(require 'erlang-start)
For c(tut) to work, there has to be a tut.erl file in the current directory.
This is easy to accomplish if you start the Erlang interpreter from the command line, as is common on systems like Linux and OS X, but this isn't the usual pattern on Windows. When you start Erlang on Windows from the icon in the Start menu, the current working directory defaults to the location of werl.exe, which isn't where your tut.erl file is.
To make your command work as expected, you have to change your working directory to be the location of tut.erl after starting the Erlang shell. If tut.erl is on the Desktop, the command will be something like this on Vista or Windows 7:
cd("c:/Users/myname/Desktop").
(Yes, you have to use forward slashes. Backslashes are special in Erlang strings.)
On Windows XP and older, your Desktop folder is buried much deeper. It might be simpler to put werl.exe in the system PATH and use the command line on such systems.
It isn't necessary, but you might want to consider installing Cygwin. Its Bash shell will give you a more Linux or OS X like environment, which will help you work with other tutorials that are structured for those OSes.
After you install Erlang open the shell and do:
1> pwd().
C:/Program Files/erl5.7.1/usr
ok
2>
Assume you have a file; "tut.erl" on your desktop. Content might look like this:
-module(tut).
-compile(export_all).
hello_world() ->
hello.
You must change the path of the current working directory to the desktop first (or where ever you want to do the compile). Like this perhaps:
2> cd("F:/Desktop").
F:/Desktop
ok
3>
Then you can perform the compile.
3> c(tut).
{ok,tut}
4>
Then test the module
4> tut:hello_world().
hello
5>
More info refer to the documentation here: Erlang official documentation
More info on the shell, look here: Shell module
Hope this gets your started.
You can also create an initialization file named .erlang under YourErlangInstallationPath\usr\
the content of the file should look something like this;
io:format("consulting .erlang in ~p~n" ,
[element(2,file:get_cwd())]).
%% Edit to the directory where you store your code
c:cd("O:/Erlang.Umut").
io:format("Now in:~p~n" , [element(2,file:get_cwd())]).
it will automatically change the path to your working folder. (Obviously, my path is O:/Erlang.Umut, you need to replace it with yours.)
No need to change folders every time you launch console. Console will be able to reach your erl files directly.
I recently tried Erlang on windows.
use the console window to make sure the text editor you are using is giving your files the correct extension ie. filename.erl and not filename.erl.txt like mine was!
when I saved my files in notepad it added .txt so I saved in unicode. fixed
If you are still getting "tut:erl:none: no such file or directory", the file name is wrong. If you open a Windows command prompt and move to your desktop and type "dir" you will see that tut.erl is really named tut.erl.txt. type "ren tut.erl.txt tut.erl" and now your compile will work.
When werl's current working directory is same as the file to be compiled, the filename is given as an argument without the whole path.
Otherwise, for eg. Assuming tut.erl is placed at C:\ErLang tutorials, one may try compiling as,
c("C:\\ErLang tutorials\\tut").
Note:
Without double quotes the : causes syntax error
The backslash is given using escape sequence

Resources