Hot answers tagged

2

I updated the answer, now it also searches in sub-folders of the parent and child folders. MaxLevel is a delimiter for parent folders meaning don't go any deeper than that "parent folder" For example if you have "Folder_F" as input and want to search for a folder called "my folder" and MaxLevel is "Desktop". It would ...


2

You can use the way, the parser works to "split" the current folder (%cd%) into the desired base path and "commenting out" the rest: set folder=%cd:\SomeFolder\=\SomeFolder&REM % echo %folder% Run it with echo off to watch the "magic" happen. Read the output of set /? to learn how the substring substitution works. If ...


2

You can also use sudo env PATH=$PATH ...rest_of_command_here.... Since that's not so convenient to type, I've added an alias alias sudop='sudo env PATH=$PATH'. The sudop (rather than aliasing sudo itself) is a reminder to me to make me aware that I am preserving my current environment path.


1

I would like to know the full list of variables that I can use in Windows Explorer or related relative paths that is accepted by Windows 10. Variables like %appdata%, %userprofile%, %windir%...etc. You can list the system's environmental variables by running the following PowerShell command: Get-ChildItem Env: | Sort Name Any variable that contains a path, ...


1

If you want to see the list of paths available such as %AppData% and similar then simply open a command prompt and type set. You will see something like ALLUSERSPROFILE=C:\ProgramData APPDATA=C:\Users\<your user profile>\AppData\Roaming CommonProgramFiles=C:\Program Files\Common Files CommonProgramFiles(x86)=C:\Program Files (x86)\Common Files ...


1

One line version using operator && or || if exist/not exist: >nul 2>&1 pushd "%cd%\my_Folder" &&(popd & set "Bool=True")|| set "Bool=False" set Bool & echo=%Bool%


1

Batch file programming is messy.  I can’t find any one solution that works perfectly.  But this three-pronged approach seems to work: SET CURR_PATH=%CD% :: Assume/anticipate failure set "FOLDER_EXIST=False" cd /d "%INPUT_PATH%\%REL_PATH%" 2> nul && ( if exist %FOLDER_NAME%\ set "FOLDER_EXIST=True" if ...


Only top voted, non community-wiki answers of a minimum length are eligible