You are not logged in.

#1 25 Nov 2015 16:03

hozza
Member
Registered: 05 Jul 2014
Posts: 27

help needed with path result!!

Okey I have this code:

@ECHO off
SETLOCAL
set found=
FOR /F "tokens=1-3 delims= " %%a IN ('REG QUERY "HKEY_CLASSES_ROOT\Applications\exampleprogram.exe\shell\open\command"') DO (
 set found=%%c
)

for /f "tokens=1-2" %%a in ("%found%") do (
 set mypath=%%a
)
echo %mypath%
ENDLOCAL

and result is: "C:\Somefolder\Exampleprogram\exampleprogram.exe"

QUESTION IS HOW TO GET RESULT WITHOUT exampleprogram.exe (like this: "C:\Somefolder\Exampleprogram" )

Offline

#2 25 Nov 2015 16:43

Shadow Thief
Member
Registered: 12 Jul 2012
Posts: 205

Re: help needed with path result!!

Use

 set mypath=%%~dpa

The d returns C:\ and the p returns Somefolder\Exampleprogram

You can look at the output of for /? for additional options.

Offline

#3 25 Nov 2015 18:45

hozza
Member
Registered: 05 Jul 2014
Posts: 27

Re: help needed with path result!!

Shadow Thief wrote:

Use

 set mypath=%%~dpa

The d returns C:\ and the p returns Somefolder\Exampleprogram

You can look at the output of for /? for additional options.


Thank you works like a charm!!!  smile  smile

Offline

Board footer

Powered by