Is there a way to launch a command a new tab with cmder? - cmder

I want to make a little script that opens two npm scripts, each one in their own tab but I am not able to find a way to do this.
If I do cmd -new_console it opens a new tab with cmd not cmder
If I do {cmd::Cmder} -new_console it fails
If I do Cmder -new_console it opens a new tab and a new Cmder window.
How can I achieve this?

This might be what you want:
cmd /k "%ConEmuDir%\..\init.bat" -new_console

Use
Cmder -new_console /single
I got this from the error that cmder gives you when you enter an incorrect flag.

Related

Run a cli command in Electron app cannot find code command

i build an electron's app ,which use nodejs to exec cli
when in debugger, it execs some commands like cp , open ,and even "code" ,all of them are ok
// code is cli which can open vscode's projects
when i use electron-packager . to package this app
and run it ,it shows can not find code command .
i think it maybe a problem from electron ..
my env is :
1.mac
2.electron v13.1.6
3.v12.18.0
Thanks a lot!
i found the same question from here
npm: command not found when executing commands in Electron app
and got the answer from here and there
1.https://github.com/electron/electron/issues/7688
2.https://github.com/sindresorhus/fix-path

How to update your surge.sh project?

I deployed a surge.sh project and it was published successfully, however, I want to make some updates to the project, the updates have been applied locally and can be seen working but it tried to publish it to the same domain again yet it doesn't appear updated. I also tried to tear down the project and re-upload it still it shows the old project, I cleared the cache too but it still didn't update. Any idea why?
To update a project you just need to publish it again to the same domain.
You can do this quickly by creating a file called CNAME in the project root directory to set the default domain name, like this:
echo site-name.surge.sh >CNAME
Then each time to update:
surge .
Alternatively, without a CNAME file, specify the domain in the surge command like this:
surge --domain site-name.surge.sh .
See https://surge.sh/help/remembering-a-domain .
This will not solve the need to tear down and republish the site described in the original post, but if you're not having that problem, it will make it quick to update your surge.sh project, as per the title question, without the need to edit the domain the usual prompt.
Open Git Bash.
Switch to the project directory.
Type surge and click Enter.
Click Enter in line "project".
Enter URL of your project in line "domain" and click Enter.
That's it!
Use the following deploy script to update your deployed Surge Project
"deploy": "surge --project ./path_to_build_folder --domain custom-domain.surge.sh"
Just go to your project folder, use cd to select your project directory, then type npm run build , then change directory to build directory cd build and then use surge
Edit:
Example \
You need go to your project directory, in my case it's jamming
$ cd ../
King#DESKTOP-5ERNS17 MINGW64 ~/Documents/Projects/jamming (main)
$ pwd
/c/Users/King/Documents/Projects/jamming
King#DESKTOP-5ERNS17 MINGW64 ~/Documents/Projects/jamming (main)
Then you do npm run build, I guess you need to update the build.
King#DESKTOP-5ERNS17 MINGW64 ~/Documents/Projects/jamming (main)
$ npm run build
Once the build is compiled, go in to the build directory by using cd build and then do surge
King#DESKTOP-5ERNS17 MINGW64 ~/Documents/Projects/jamming (main)
$ cd build
King#DESKTOP-5ERNS17 MINGW64 ~/Documents/Projects/jamming/build
$ surge
That's how it worked with me. If I don't do npm run build before the surge just won't update it... I don't know if this is the right way...
To update your Surge project, simply run surge in the project directory and input the same domain you're already using in the domain: prompt.
Some users are describing a problem where they have to do a hard refresh to see their updates. This is to be expected, and happens with any static file host, since static files are cached by your browser to make page loads faster.
So to see the latest version of your Surge site, press Ctrl+Shift+J or F12 to open the developer tools, and right-click on the reload button in the browser's unibar, and click on Empty Cache and Hard Reload.
Open Cmd.
Switch to the project directory.
Type surge . and click Enter.
and change the random domain with your web that's want to update and hit enter.
That's it <3
Go to the directory project and use git or cmd and this structure:
type surge and hit enter
hit enter in project line
replace the random domain with your web url
hit enter

I have to run "/bin/bash --login" everytime to use rake/rails commands?

whenever I switch directory in my terminal, I have to run the command "/bin/bash --login" before I can run rails/rake related commands. If I don't, I get an error saying "the program "rails" can be found in the following packages: ..."
Any advice?
By default some servers do not allow this due to permissions reason. You can place this in
~/.bashrc and it will automatically work when you open a new terminal
As per bash man page.
When an interactive shell that is not a login shell is started, bash
reads and executes commands from ~/.bashrc, if that file exists. This
may be inhibited by using the --norc option. The --rcfile file option
will force bash to read and execute commands from file instead of
~/.bashrc.
When bash is started non-interactively, to run a shell script, for
example, it looks for the variable BASH_ENV in the environment,
expands its value if it appears there, and uses the expanded value as
the name of a file to read and execute. Bash behaves as if the
following command were executed:
if [ -n "$BASH_ENV" ]; then . "$BASH_ENV"; fi but the value of the
PATH variable is not used to search for the file name.
The file is just shell commands. It is typically used to change prompts, set environment variables, and define shell procedures. Traditionally, the file .profile is used for this purpose, but bash has so many extensions that it needs its own startup file for users that want to put bashisms in startup files.
Easy solution:
Just open terminal. GO to Edit menu from terminal navigation bar, Select "Profile Preferences", It will open "edit profile pop-up". Select "Title and Command" button and "check Run Command as login shell"
ctrl + alt + t -> Edit -> Profile Preferences -> Title and Command -> Check Run command as login shell
Close the terminal and open again. Next time you don't need to "/bin/bash --login"

Executing things on console2 startup

I am using console2 and I am trying to execute a few simple things when I fire console2 like
set PATH=%PATH%;C:\MyPgm\Git\bin
How can I do such things.
And on the side is there somewhere I can find example of nice configs of console2
The version I am working with is 2.00.148
First, create a batch file (*.bat) with any name you like ("shell.bat") and add the lines to be executed on the start up of the console.. additionally you have to add "cmd" (or "bash") command at the end of file to open up the command shell...the file will be like that
#echo off
set PATH=%PATH%;C:\MyPgm\Git\bin
cmd
then run console2 ..from Main Menu > Edit > Settings > "Console" Node .. and press ".." button beside "shell" field ,select "*.bat" file type then select the file you created earlier OR write down the path to this file..(you can also set working directory in "startup dir")...save and restart
that's it !!
Enjoy !!
My use case is that I would like to run a command just after start the console2, in this case it is a command to set ruby version. The process is similar to #nobleCoder
create the .bat file, I name it ruby_setup.bat
#echo off
set init_ruby_243=uru 243p205
cmd.exe /k "%init_ruby_243%"
specify .bat file to execute when start the console2 by going to Edit > Settings then at the Shell field select the file ruby_setup.bat or manually input it like C:/users/myname/ruby_setup.bat then save and restart.
Hope this help.

Powershell why popup window, how to stop it

Not sure why when I execute a Python tools like pip or nosetests inside powershell, a separate popup command line windows will show, execute my command, then disappeared. This is annoying because I can hardly see the executable output, especially the last few lines before the popup close.
I assume there are some setting I can change to stop the popup?
I am using Powershell 2.0 in Windows 7.
Powershell is not cmd.exe, and it has a different console interface. More than likely, your py tools are writing to a non-existent shell window. You may be able to get around this by using the following syntax:
cmd /c script.py
What you do when you execute the python scripts directly from the PS prompt is fire-off a DOS shell for the period of time it takes for the command to complete. Since there's no 'pause' implemented, the shell window closes when the command completes.
A test script
# tester.py, just a test
print "This is a test script, that is all."
Output in PS:
C:\src\python
{powem} [36] --> .\tester.py
C:\src\python
{powem} [37] --> cmd /c .\tester.py
This is a test script, that is all.
mp
For someone has similar problem, please have a look at this answer, I think this solution eventually solved my problem. and in my case, I have to restart my computer to get it all working.

Resources