I have a batch file located in several folders and in this file I need to replace the old subst T: . command for net use because the units (drives) have different properties in windows 7.  However, I have only found that net use only allows for absolute paths such as:  net use T: \\path\to\folder   I cannot work with absolute paths, but net use T: . is not allowed (it throws an error).  Is there a way to execute the net use command from a folder so that it uses the current .bat directory?  I think the best solution for me it would be to be able to get the absolute qualified path (\path\to\folder) with a batch command. (%cd% and chdir variables do not work in this case). Questions about getting the current directory or folder name are not useful since the net usecommand does not allow paths such as x:\path\to\folder
123893
Is it possible to get the current folder name (not current directory path)  by using a DOS command?  If so, how?  The closest I got was this but it doesn't do it:  for /f "delims=\" %%a in ("%CD%") do set CURR=%%a echo.DIR: %CURR%   note: the above attempt was me attempting to tokenize the string and get the last token set as the CURR variable.
95118
The windows command line prompt display the full path of the currently directory, which will be too long when I am deep into a directory, like:  V:\Runtimes\ProjectName\src\ToolsTest\JavaCrashExample\JavaCrash\main\ToolsTest\JavaCrashExample\JavaCrash&gt;   Is their any way to customized this, so that I can just display the current directory's name?  Thanks.
24773
How can I copy a file using DOS commands into a directory structure that may not yet exist? I need to be able to force the creation of the directory path to the target file location if that location doesn't already exist.  For example, there is already a file.txt in this location:  C:\file.txt   And I want to copy it to  C:\example\new\path\to\copy\of\file\file.txt   but at this time  C:\example\   and all the subdirectories may or may not yet exist.  Basically, I am looking for a "copy and create the target path if necessary" command. What would you recommend is the best way to achieve this?
31213
I am looking for a way to delete all files older than 7 days in a batch file.  I've searched around the web, and found some examples with hundreds of lines of code, and others that required installing extra command line utilities to accomplish the task.  Similar things can be  in just a couple lines of code. It seems that something at least remotely easy could be done for batch files in Windows. I'm looking for a solution that works in a standard Windows command prompt, without any extra utilities. Please no PowerShell or Cygwin either.
20595
Given two absolute paths, e.g.  /var/data/stuff/xyz.dat /var/data   How can one create a relative path that uses the second path as its base? In the example above, the result should be: ./stuff/xyz.dat
106417
I have a program on my path.  The program runs when executed with a full path specified.  But the program cannot be found when I run it with just its name.    Essentially, I want to understand how the below output is possible, and how to fix it so that my program can actually be found without a full path specified:  root:/usr/local/bin# ./siege **************************************************** siege: could not open /usr/local/bin/etc/siegerc run 'siege.config' to generate a new .siegerc file **************************************************** root:/usr/local/bin# echo $PATH /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games root:/usr/local/bin# siege bash: /usr/bin/siege: No such file or directory root:/usr/local/bin# wtf!?!?   I'm on Ubuntu 12.04 using bash.  Also please note the warning output from siege is not relevant for the purposes of this question, as I am only interested in whether or not the program can be found and invoked.
109946
Say I have PATH="home/bob/bin:/usr/bin".  I am writing a bash script /home/bob/bin/foo that will do some munging and then call /usr/bin/foo.  Of course I want to be able to use this script on different systems which have different path structures.  In practice the real foo might be in many different places, so I want to just find it from the PATH.  My new foo script is on my path too, so I can't just call foo, that will result in a recursive call.  Is there an easy way of doing this in a bash script? (Other than looping through elements of PATH and doing the search manually?)
57357
How do I safely delete all files with a specific extension (e.g. .bak) from current directory and all subfolders using one command-line? Simply, I'm afraid to use rm since I used it wrong once and now I need advice.
60629
I've been trying to keep some files in a separate folder as shortcut, so that I can keep track of my favourite media files and images etc in a specified folder as shortcut. I don't want to always copy these files everytime to that location so I was thinking of making it easier by adding a shortcut to the "send to" menu... I have windows 7 on my pc.  I'm trying to create a shortcut similar to the "send to Desktop (create shortcut)" that can simply place a shortcut in my "C:\Fav Media" folder, or similar location AS A SHORTCUT. Methods I had in mind:   Create a batch file that takes any file as input and creates a shortcut of that file in that folder. Thus any file can be dropped to the batch.bat.lnk shortcut and it's shortcut is sent to that folder. If file drop is successful, then I believe that send to option will do the same thing. I checked the "desktop (create shortcut).desklink" and it's extension is as already mentioned: .deskling.    I don't intend to play with registry, so if there's any file like a xml or txt or bat in windows that manages .desklink kind of extensions and does place shortcut from sendto menu no matter what the shortcut.desklink is named as, then maybe I could edit that xml and place the "C:\fav folder" as an addition in extensions to that xml with extension: ".favlink" ...  Is this possible? Can this be done in windows 7?  Thanks for any help.
20264
This may be a silly question, and I think I have looked elsewhere to find the answer...  Might be a path issue, but when I open the command line and type from the C:\&gt;: cd D:\  I cannot get to the D drive.  Even if I type: cd D:\&lt;folder name&gt;  The command.exe will auto-complete the line with the tab key, so it knows where I'm at.  It just doesn't print to screen the result or actually get me there.  This problem exists for the network drives as well. Now, if I use the chdir (cd) command like this: chdir D: or cd d: I get the print out of the D:\ below the command but it still says I'm in the C:\. I feel like I'm missing something simple.
96977
Say I have a file called calc.exe ( for example).  When I go to CMD and I run calc.exe it runs  because Windows has PATH settings in its environment variables.  Path information is  also accessible via typing path in cmd. ( as we all know).  Question  But - Is there any command in cmd that shows me information like this :   c:\&gt; locate_Where_It_Will_run_From calc.exe   Response :   c:\windows   I mean , the only solution which I see now is to run :   dir /s  calc.exe   And then to match results with the PATH information .  Is there any such command which will show me the information of my example above ?
97300
I would like to create a batch file, that will add registry key, not manually, but full automaticly by .BAT file.  goes about adding everything but not the key.  shows how to add everything, and how to add key manually, but it requires user interference, which I am trying to avoid.  Is there possibility to add KEY (non REG_*) to "folder?" in registry by one simple batch file?
101452
I would like to write a set of shell scripts which would execute smoothly on Mac disregarding where they are called from.  I am currently struggling about how to implement this.  On windows, I could write three batch scripts  A.bat in folder A B.bat in folder Subfolder, which is subfolder of A and which path is A/Subfolder C.bat in folder Subfolder, which is subfolder of A and which path is A/Subfolder  In A.bat I could write  call Subfolder/B.bat   in B.Bat I could write  call C.bat   and both scripts A and B would execute successfully.  On Mac, however, I have to prepend ./ to every script so that it is recognized as script.  So when I write in a.sh code:  Subfolder/b.sh   and then in b.sh code  ./c.sh   when I execute ./b.sh from terminal it is executed successfully.  However, when I execute ./a.sh from a parent folder in terminal, it fails with error   ./a.sh Subfolder/b.sh: line 1: ./c.sh: No such file or directory    Is this possible on Mac to write a code in b.sh which would execute disregarding if it is called from the current folder or from the parent folder?
47343
Given a path such as "mydir/myfile.txt", how do I find the file's absolute path relative to the current working directory in Python? E.g. on Windows, I might end up with:  "C:/example/cwd/mydir/myfile.txt"
13829
This is a situation I often find myself in:  mkdir /Some/really/long/path/to/a/directory/ cd /Some/really/long/path/to/a/directory/   I know that ideally you would cd /Some/...etc.../a/ and then mkdir directory, but I've often performed mkdir first and then had to cd to the end of the same lengthy file path I just created.  Short of doing...  var="/Some/...etc.../a/" mkdir $var/directory; cd $var   ...which is even worse, is there some way to reuse the parameter passed to the previous command? I'm aware of course of tab completion, but in a series of nested directories with similar names this doesn't always help that much. Ideally, I'm hoping for a shortcut like $# or $@.  Failing this, the next best time-saving solution would be equally appreciated!
105709
I need to changed directory using batch file in PowerShell.  Let's say the batch file named go.bat has the two lines of code. And I'm in q: directory.     c:    cd c:\abc\def   When I run go.bat, I'm still in q:
79448
I am trying to run an executable file from a network drive on Windows 7 Professional (64-bit) in order to install a program, but, each time I try, it doesn't run and the following message appears:  {path-name} The specified path does not exist. Check the path, and then try again.   I am definitely connected to the network drive as I can see all of the directories and files, and can even open non-executable file types. Also, I am fairly confident that this is neither a firewall nor a permissions issue.