6

I have a flash drive with subversion, python, php and notepad++ on it along with several of my ongoing projects. I do this to be able to resume work on any PC with an internet connection. Currently I have a .bat file that sets up the necessary paths as well as setting the current directory to my projects folder. I run this .bat file by opening a commend prompt and drag&dropping it in.

Here is what I'd prefer: Opening the .bat file would open the configured command prompt and stay open.

Alternatively my flash drive could contain a shortcut to c:/Windows/System32/cmd.exe with the bat file as an argument (if that is possible)

Any way this could be done would be helpful and timesaving

5
  • I think you'll be running into the problem that the drive letter will not be the same on all machines you're plugging into.
    – slhck
    Apr 30, 2011 at 18:35
  • 1
    I'm not hard-coding the location :)
    – Hubro
    Apr 30, 2011 at 18:43
  • 3
    @slhck: That is not a problem, as you can set the path on the same drive as the batch script using the %~d0 parameter. eg. path %~d0\Utils;%PATH%
    – paradroid
    Apr 30, 2011 at 19:13
  • @paradroid Ah, great, learned something today :)
    – slhck
    Apr 30, 2011 at 21:34
  • How about a simple shortcut to something like cmd /k x:\setvars.bat (where x: is your flash-drive–letter)?
    – Synetech
    Nov 11, 2012 at 1:02

3 Answers 3

5

End the .bat file with:

cmd

or

%COMSPEC%
2
  • Writing cmd made the cmd go into an infinite loop of setting cd. %COMSPEC% worked wonders though! Thanks
    – Hubro
    Apr 30, 2011 at 18:42
  • 3
    @Codemonkey: Probably caused by your file being named cmd.cmd or cmd.bat Apr 30, 2011 at 18:46
2

Command Prompt Portable from Portable Apps might be what you are looking for.

Features

Command Prompt Portable is a simple utility that allows you to have a custom command line setup on any Windows computer you come across. It has built in support for the command line interpreters on both Windows 95/98/Me and Windows 2000/XP/Vista as well as the ability to customize using simple DOS commands by editing the .bat file within CommandPromptPortable\Data\batch after you've run it once. You can customize the prompt, colors, window title, columns and more. A basic batch file is included with some simple settings.

You can also pass in paths you'd like the command prompt to start in by starting CommandPromptPortable.exe with a command line parameter of the path (Windows 2000 and up only). Advanced users can enable auto-complete by following the directions within the Other\Source\readme.txt file.

Helpful Tip: Launch a command prompt with your own portable command line tools in the path by adding SET PATH=%~d0\UtilsDirectory;%PATH% to the batch file and placing your tools in X:\UtilsDirectory

0

Open notepad and enter:

command.com

Then save it as anything.bat. Open it and use cmd.

1
  • command.com is not the same as the Windows command-prompt. If they use that, then many/most of the enhancements (e.g., filename completion) will be lost, not to mention everything just running slower in general.
    – Synetech
    Nov 11, 2012 at 0:43

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .