Jump to content

If Exist... better code


Recommended Posts

Finding out which drive has the install files?

Try this:

FOR %%i IN (C D E F G H I J K L M N O P Q R S T U V W X Y) DO IF EXIST "%%i:%TAGFILE%" (SET CDDRIVE=%%i:& goto DONECD)

:DONECD

Early in the build, it'll save a coupla nanoseconds.... late in the build, it will save me having to click OK btn 4 times 'cos I have camera card readers..... pls do it 'cos it costs you nothin' and can save me time

Bashrat: I love ur work. Pls do this in Presetup.CMD (sure ya tried it before - look at the spacing - mine works)

Link to comment
Share on other sites


  • 4 weeks later...

You can use this code instead:

SET CDDRIVE=%~d0
:DONECD

If the script is on the cd it gives you your cd-drive-letter.

You can also get a path relative to the script-path.

::set a path relative to the script
SET DIR=%~dp0..\Anwendungen
::create the absolute path
PUSHD "%DIR%"
SET DIR=%CD%
POPD
::output absolute path
ECHO %DIR%

Greetings

Al

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...