Open user variable location from cmd - powershell

I created a user environment variable name: teamf and its value as C:\Program Files\TeamExplorer\Common7\IDE\CommonExtensions\Microsoft\TeamFoundation\Team Explorer\
This is working since from run I can open the folder by merely typing %teamf%
Now I want to change the directory from root to to this folder location in command prompt (cmd). How can I do that? I have tried:
%teamf% cd teamf
but I get errors (see attached image please)

This should do it:
CD "%teamf%"

Related

Why can't MATLAB find a script that is on MATLABPATH

I've just created a script file in MATLAB, but can not run it. The name of my script is getEnvFiles.m. When I first tried to run it, I got the following result:
>> getEnvFiles
'getEnvFiles' is not found in the current folder or on the MATLAB path, but exists in:
\\wsl$\ubuntu\home\me
Change the MATLAB current folder or add its folder to the MATLAB path.
So, I added this directory (which is actually the current directory) to the search path, but still got the same result:
>> addpath('\\wsl$\ubuntu\home\me')
>> getEnvFiles
'getEnvFiles' is not found in the current folder or on the MATLAB path, but exists in:
\\wsl$\ubuntu\home\me
Change the MATLAB current folder or add its folder to the MATLAB path.
When I check the path, it looks like this directory is on the path:
>> path
MATLABPATH
\\wsl$\ubuntu\home\me
I can further verify that this directory is my present directory:
>> pwd
ans =
'\\wsl$\ubuntu\home\me'
and that getEnvFiles.m is in this directory:
>> ls
. .emacs.d HarborData
.. .emacs~ RawHarborData
.bash_history .landscape at
.bash_logout .motd_shown getEnvFiles.m
.bashrc .profile test.m
.bashrc~ .sudo_as_admin_successful
.emacs
Is the issue that I'm using wsl (Windows Subsystem for Linux), or do I have some other misunderstanding?
Type rehash and then try running your script again. Even though you have added the new directory to your path, you need to update the path cache so that it knows about the new scripts it can see.
The problem seems to lie in WSL's ability to add new files to the directory. When I create a new script within MATLAB, and try to run it, I get the problem discussed above. However, running already existing files is not a problem. For now, my only solution is to close MATLAB after creating a new script and reopen it. Then, I can run it. Although, oddly, I can't open it in MATLAB's editor.....
This may or may not help, but ...
Sometimes you have to prepend execution with .\ in order to run scripts in PowerShell or from within the command prompt (in Windows, I'm not sure about other operating systems).
I get this error quite often, especially when not in Admin mode.
Does this work?
% Get path of executing script.
filePath = matlab.desktop.editor.getActiveFilename; % Note that this isn't necessarily the same as the output of 'pwd()'.
% Or: filePath = mfilename('fullpath')
% Make sure all nested directories of filePath are on the path, then tell MATLAB where you're working.
addpath( genpath( filePath ) ); % If this fails, try one folder up the tree:
% addpath( genpath( fullfile( filePath, '.' ) );
cd( filePath );
Alternatively, it looks like you might have written and saved the script, and then typed it into the command window to execute. If it's not a special type of script (Function/Class/GUI/etc.) then you can simply click 'Run' in the Editor tab (or the F5 key) and MATLAB should prompt you with a 'Change Folder' option, to which you should acquiesce.
If you're running this script through the WSL terminal, try my suggested code.

Why is the "dir" command not showing me certain folders?

I used the dir command in the Windows command prompt to display the list of files/folders in a directory. I noticed that it did not display a folder named tmp. However, I tried running dir in Powershell, and it did display the tmp folder in the output. Why did the Windows command prompt hide this folder from me?
You need to add the "show hidden" option to dir:
dir /a
this should do the trick.
source
Try attrib /?. EG attrib c:\folder\tmp /d.
A leading dot means nothing in Windows.

Updating bash environment variables using source

On OS X Mountain Lion The source command only seems to update my path when I have added something to it in .bashrc or .bash_profile. If I delete a path from either of these files, then use source to update, the deleted path remains. An example...
Adding to my PATH in .bash_profile
In terminal
> echo $PATH
> "/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/opt/X11/bin"
Add to path in .bash_profile
export PATH=$PATH:~/Desktop
Back in terminal
> source .bash_profile
> echo $PATH
> "/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/opt/X11/bin:/Users/myname/Desktop"
So, all that went as expected; my Desktop has been added to my PATH. Now after I delete the previously added path from .bash_profile, leaving this file empty
> source .bash_profile
> echo $PATH
> "/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/opt/X11/bin:/Users/myname/Desktop"
As you can see the 'deleted' path '/Users/myname/Desktop' remains. Am I misunderstanding what
source does? I thought It was equivalent to opening a new terminal window (which does return
the result I was expecting - i.e. no Desktop path)
When you use source .bash_profile first time, because of export PATH=$PATH:~/Desktop line from .bash_profile file, your PATH is reassigned to old PATH to which is added ~/Desktop directory.
When you use source .bash_profile second time, the PATH is not anymore reassigned because you delete export PATH=$PATH:~/Desktop line. So, this time the value of your PATH remains unchanged (like before).
You have to restart your terminal (current shell) if you want that the value of your PATH to return to its initial value. Or you can source your /etc/environment file:
source /etc/environment

'findstr' is not recognized as an internal or external command,

I got the following error while starting JBoss from a command line prompt today:
'findstr' is not recognized as an internal or external command
Please google it, you can find a lot of answers. But do as below to fix it. Add the following value to Right Click My Compuer -> Advanced -> Environment Variables -> System Variables -> Select Path variable -> append the below value.
C:\WINDOWS\system32
It should work with that change.
As others pointed, issue is in wrong settings of PATH variable in Windows.
According to article this is most probably because some stupid installer wrongly modified PATH variable in Windows registry. Registry has 2 different string value types - REG_SZ and REG_EXPAND_SZ. Only the second one allows for expansion of %SystemRoot%.
So check your path by typing set path in command prompt. If you see unexpanded %SystemRoot% and other variables in Path, you are affected (PATH should show only plain directory names, not variables).
You need to edit Path variable in registry: HKEY_CURRENT_USER\Environment and HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Environment. As it is not possible to change the type of key, save the path value somewhere, delete the key and re-create it with type REG_EXPAND_SZ. You need to logout for changes to take effect.
for me it works when I've coped findstr(from windows/system32) to wildfly/bin
Please go throught the simplest steps:-
go to C:\Windows\system32\ and copy findstr.exe file.
paste this file into the location C:\Program Files\Java\jdk1.6.0_24\bin
Run your jboss again you will get out of this.....
Check to see if you %SystemRoot% is evaluating (type set path into a command prompt, you should not see %SystemRoot%, but instead that actual path). If your path variable's (user, or systems) first entry begins with an %(an environment variable) this can cause an issue.
To resolve this, simply swap this first entry with anything else in your path that does not lead with an environment variable.
You can also hard code the directory by replacing 'findstr' with 'C:\Windows\system32\findstr'. This is useful when using systems with restricted user permissions.
I have try to work with play framework but stuck with to run activator.bat file but solution is the same just copy file from windows/system32/findsr and past it to under stuck folder then run the respective file again.
thanks to andrewsiand Suryaprakash
Please beware that current Windows systems use a Capital "S" for the System directory, so:
C:\WINDOWS\System32
%SystemRoot%\System32
Omitting the capital S will result in a neglect of the line in the %PATH%
In my case (not JBoss related) the following helped to fixed this error.
Instead of:
SET path="%path%;C:\some\additional\path"
I used:
SET "path=%path%;C:\some\additional\path"
For IBM ACE solution for
'findstr' is not recognized as an internal or external command,
Go to the path C:\Windows\System32
Find the findstr.exe, copy it and then find the path where you bin file of your application is found. eg C:\Program Files\IBM\ACE\11.0.0.12\server\bin then past it inside the bin file
cancel the console of ace and re-open it.
Then run ACE toolkit command on ace console.
Then press enter, now it can open.

Where is NSTemproryDirectory present?

I am doing image caching and I am saving the files to a temporary directory NSTemporaryDirectory. Its seen in log as /var/folders/.... .Where is this thing present. I am currently doing all this in the simulator?
You can use the following line to find out:
NSLog(NSTemporaryDirectory());
Gives me the path path like this: /var/folders/c9/c9ooh947H2WloiBIdpTdcU+++TI/-Tmp-/
You can browse there in terminal:
cd /var/folders/c9/c9ooh947H2WloiBIdpTdcU+++TI/-Tmp-/
/var folder is hidden on MacOS and is not shown in Finder by default. You can switch on showing hidden folders using this terminal command:
defaults write com.apple.finder AppleShowAllFiles -bool true
After that it must become visible in Finder in root folder