Scriptcs Is Not Recognized As An Internal Or External Command Operable Program Or Batch File.

Jul 31, 2014  'scrapy' is not recognized as an internal or external command, operable program or batch file. I've checked my%PATH% which has both the Python27 directory and the Python27 Scripts directory which is where the scrapy 'binary' resides.

What is it?

scriptcs makes it easy to write and execute C# with a simple text editor. Fallout 2 the den.

While Visual Studio, and other IDEs, are powerful tools, they can sometimes hinder productivity more than they promote it. You don’t always need, or want, the overhead of a creating a new solution or project. Sometimes you want to just type away in your favorite text editor.

scriptcs frees you from Visual Studio, without sacrificing the advantages of a strongly-typed language.

  • Write C# in your favorite text editor.
  • Use NuGet to manage your dependencies.
  • The relaxed C# scripting syntax means you can write and execute an application with only one line of code.
  • Script Packs allow you to bootstrap the environment for new scripts, further reduces the amount of code necessary to take advantage of your favorite C# frameworks.

Try scriptcs

You can try scriptcs right now in the browser using Kata<oda. Click the image below to get started!

Getting scriptcs

Releases and nightly builds should be installed using Chocolatey. Information on installing Chocolatey is available at their website.

Installing scriptcs

Once Chocolatey has been installed, you can install the latest stable version of scriptcs from your command prompt:

Chocolatey will install scriptcs to %APPDATA%scriptcs and update your PATH accordingly.

Note: You may need to restart your command prompt after the installation completes.

Staying up-to-date

With Chocolatey, keeping scriptcs updated is just as easy:

Nightly builds

Nightly builds are hosted on MyGet, and can also be installed through with Chocolatey:

Building from source

Execute build.cmd to start the build script.

Getting Started

Using the REPL

The scriptcs REPL can be started by running scriptcs without any parameters. The REPL allows you to execute C# statements directly from your command prompt.

Writing a script

  • In an empty directory, create a new file named app.csx:
  • Install the RavenDB.Embedded package from NuGet using the install command.
  • Execute your script. Note that listening on a port requires that the command prompt be launched using the Run as Administrator option.
  • Navigating to the URL that Raven is listening on will now bring up the RavenDB management studio.

Bootstrap scripts with Script Packs

Script Packs can be used to further reduce the amount of code you need to write when working with common frameworks.

  • In an empty directory, install the ScriptCs.WebApi script pack from NuGet. The script pack will automatically imports the Web API namespaces and provides a convenient factory method for initializing the Web API host. It also replaces the default ControllerResolver with a custom implementation that allows Web API to discover controllers declared in scripts.
  • Script packs can be imported into a script by calling Require<TScriptPack>(). Create a file named server.csx that contains the following code:
  • In a command prompt running as administrator, execute the server.csx file.
  • Browse to http://localhost:8888/test/ to see the result of the TestController.Get method.

Referencing scripts

  • Move the TestController class from the previous example into a new file named controller.csx with the following content.

  • On the first line of server.csx, reference controller.csx using the #load directive. Note: #load directives must be placed at the top of a script, otherwise they will be ignored.

  • In a command prompt running as administrator, execute the server.csx file.
  • Browse to http://localhost:8888/test/ to see the result of the TestController.Get method.

Referencing assemblies

You can reference additional assemblies from the GAC or from the bin folder in your script's directory using the #r directive:

Contributing

  • Read our Contribution Guidelines.

Samples and Documentation

Additional samples can be contributed to our samples repository. Documentation can be found on our wiki.

Community

Want to chat? In addition to Twitter, you can find us on Google Groups and JabbR!

Coordinators

  • Glenn Block (@gblock)
  • Justin Rusbatch (@jrusbatch)
  • Filip Wojcieszyn (@filip_woj)

Credits

  • Check out the list of developers responsible for getting scriptcs to where it is today!
  • Special thanks to Filip Wojcieszyn for being the inspiration behind this with his Roslyn Web API posts.
  • Thanks to the Roslyn team who helped point me in the right direction.

License

Related Post