So I do a lot of work on a school computer. We can't install anything but we have most of our tools on our flash drives but I was wondering if there's a way to get Command Prompt to use Mercurial off of my Flash Drive. Let's say in theory that Mercurial's files were on my flash drive, where would I go from there?
To make Bryan's solution "truly" portable in Windows 2000/XP/Vista/7, assuming the BAT file is inside Mercurial's directory, use:
set PATH=%PATH%;%~dp0%
So, no more hardcoded paths.
Say your flash drive was drive G: and your Mercurial executables are in G:\mercurial
Open a command prompt and enter:
set PATH=%PATH%;G:\mercurial
Proceed to use hg as normal
This should work, in theory. If you're on a *nix computer, you would do something like this (given /media/FLASHDRIVE is the path to your flash drive):
export PATH=$PATH:/media/FLASHDRIVE/mercurial
Hope that helps!
EDIT
In response to the comment below:
#ECHO OFF
REM Mercurial enabler :)
set PATH=%PATH%;G:\mercurial
cmd.exe
Should do it :)
download the tortoise hg .msi setup
msiexec /a tortoisehg-1.1.4-hg-1.6.4-x64.msi /qb TARGETDIR=f:\hg-temp
it will extract the tortise hg files to f:\hg-temp path,
goto f:\hg-temp\PFiles\TortoiseHg and copy it to F:\hg
Delete f:\hg-temp\PFiles\TortoiseHg
Then add f:\hg to your path
set PATH=%PATH%;f:\hg
(f:\ is your flash drive)
Related
How to open a project in PhpStorm from command line on Windows?
I tired this:
How to open a directory in PHPStorm or IntelliJ (or any JetBrains IDE) from the command line? but can't find Tools -> Create command line launcher on Windows.
I am using latest PhpStorm.
To open the current directory just run:
phpstorm64 .
If you are using git bash on Windows run:
cmd "/C phpstorm64 ."
Make sure that C:\Program Files\JetBrains\PhpStorm 2018.3.3\bin is in your environment variable PATH (it is by default after the installation)
Edit 2021:
Install Jetbrains Toolbox
Go to settings
Enable "Shell Scripts" and follow the instructions
Now you can use "phpstorm ." to open the current directory.
On macOS ( I assume on windows too) there is option to "Create Command-line Launcher". Just click that and you are good to go next time you open a terminal.
You can even specify how you would like to start "pstorm" / "phpstorm" / "ps" etc.. up to you.
Command-line launcher is currently only available fo UNIX; there is a feature request for providing it on Windows, IDEA-114307, please feel free to vote for it.
If you like to start PhpStorm from command prompt, open cmd console, cd to %PS_install_dir%/bin and run either phpstorm64.exe or phpstorm.bat, passing a path to project folder to it, like it's described in https://www.jetbrains.com/help/phpstorm/opening-files-from-command-line.html. If you like to start it from any directory, add %PS_install_dir%/bin to your system %PATH%
I know this is too late, but it will help others if they need it:
if you want to open phpStorm in the current directory via cmd/Powershell, just use this command:
phpstorm64.exe .
Or if you want to open it in another directory, just use:
phpstorm64.exe YOUR_DIRECTORY_PATH
as simple as that!
go to your project using terminal
Cd myproject
and write
phpstorm64.exe
then hit enter
I see this is a little old but I wanted to supply my answer as I was grappling with this yesterday. My solution was to use cygwin.
Track down the phpstorm bin folder called something like C:\Users\UserName\AppData\Local\JetBrains\Toolbox\apps\PhpStorm\ch-0\201.7223.96\bin and add it to your windows system Path environment variable.
Next fire up a cygwin terminal and navigate into your project directory. I'm not a bash expert so I struggled to sort out the code as an alias but if you run:
crntproj=$(cygpath -w $PWD)
phpstorm.bat $crntproj
You need cygpath because simply running phpstorm.bat $PWD doesn't work as PHPStorm tries to open a folder called $PWD. I tried a bunch of variations trying to get it to open and none seemed to work.
It will fire up phpstorm with the current folder as the project path. And you now have a terminal feed from your project too.
I think i've deleted a whole folder by accident in sublime text 2. Is it possible to recover this deleted folder? I've checked my trash and nothing.
Using windows 7.
Same thing just happened to me.
Not to worry! Sublime does not permanently delete your files, but only moves them to trash (Recycle Bin). You will find your hard work sitting right there :)
See this reference for more information.
You can easily recover it from thrash / Recycle Bin folder on your machine.
Sublime or any other third party software never delete files permanently, in case of windows, it catches deleted files and move it to Recycle Bin.
In case you don't find in trash as in my case you can use "restore-trash" utility on linux. It can be installed using following command
sudo apt install trash-cli
After installing open command line and navigate to the folder.
Enter command
restore-trash
Choose the file which you wish to restore
If you are on windows, You can look at Recycle Bin.
Otherwise not possible without any advance tool.
Its gone buddy ! I did something similar and couldn't retrieve a file.
Anyway, not sure if it is going to help you but I wrote a simple SLT-plugin to back up modified files (locally and remote).
Local backup plugin:
class RemoteEdit(sublime_plugin.EventListener):
def on_post_save(self, view):
os.system('cp -r %s %s' % (view.file_name(), <backup_path>)) #use scp for remote backup
Would it be possible to put install THG on a shared drive and let
users run it from there without having to install it locally on each
user's machine?
I'd be willing to accept some minor loss of functionality such as no
overlay icons or menus in Explorer. Maybe people can only use the
workbench interface...
Bonus points if the local stuff could be wired up after it was
installed centrally!
I got an answer from the TortoiseHG mailing list:
There are two things you miss by not running the installer:
Explorer extension (context menu, overlay icons)
Having the apps in your PATH (thg.exe, hg.exe, kdiff.exe, tortoiseplink.exe)
The workbench and other apps should run just fine from a copy of the
install folder.
--
Steve Borho
Okay, my "initial reactions" aside, you might be able to copy the TortoiseHg folder after installing it to your machine then copying the Program Files directory a network location and run it from there. (At least, it appears to have been possible in the past)
Try copying the Program Files\TortoiseHg directory to the network share (you could use a network drive to make your life in cmd easier)
Then run thg.exe with a shortcut/cmd/Run... prompt:
<network location>\TortoiseHg\thg.exe
Good luck!
I build my little project with Hudson and would like to publish it on my network drive.
To do this, I wrote a little script which is executed after the build process:
xcopy .\Installer\bin\Release\*.* "M:\installerRelease" /I /E /Y
I tested it out of the working folder of hudson in the command line prompt and everything works great. After I put the code into Hudson and perform a build, Hudson says that everything works out well. So I take a look to my M drive but nothing's there. But the build log tells me that all the files were copied.
Is Hudson not able to write to the Netdrive?
I solved the Problem:
You need to use the server URl ...
Like:
//Server/installerRelease
I am trying to automate hg commit and hg push commands , for that I need to call those commands from firefox extension (which I am working on). Is there a way to do it without using batch files ?
Yes, you can just call hg directly like any other process.
See here how to make a command line call from within a firefox extension.
Of course for the call "initWithPath" you must specify the hg command line binary, that is also executed when you type "hg" in a Terminal window. And this command line utility will have different locations on different platforms. So if you expect the extension to work crossplatform, you should offer a preferences panel, where the users can enter the path to their local hg binary and by default you could also put there the standard path where most users on that platform would have installed hg to.