# Path condition (@ifpath) without a Lister

**URL:** <https://resource.dopus.com/t/path-condition-ifpath-without-a-lister/16562>\
**Category:** Help & Support\
**Created:** [November 14, 2013, 3:10pm UTC](https://resource.dopus.com/t/path-condition-ifpath-without-a-lister/16562 "2013-11-14T15:10:29Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Dinkelhopper](https://resource.dopus.com/letter_avatar_proxy/v4/letter/d/bc79bd/32.png) [@Dinkelhopper](https://resource.dopus.com/u/Dinkelhopper)\
**Post date:** [November 14, 2013, 3:10pm UTC](https://resource.dopus.com/t/path-condition-ifpath-without-a-lister/16562/1 "2013-11-14T15:10:29Z")

</div>

I created a global shortcut to start a command prompt (conemu.exe).

My intention is to open the command prompt at the specified sourcepath.  
If there is no Lister logically there is no sourcepath. In this case, the command prompt should be opened at predefined path.

I tried the following:

```auto
@ifpath:*
C:\Program Files\ConEmu\ConEmu.exe /Dir {sourcepath}
@ifpath:else
C:\Program Files\ConEmu\ConEmu.exe /Dir C:\
```

When a Lister exists, everything works as expected.  
But if there is no Lister, nothing happens ☹

I tried it with

```auto
@ifpathr:'.+'
```

as well ☹

Any ideas?

Thanks in advance.

---

<div class="post-metadata">

**Author:** ![Leo](https://resource.dopus.com/user_avatar/resource.dopus.com/leo/32/69732_2.png) [@Leo](https://resource.dopus.com/u/Leo)\
**Post date:** [November 14, 2013, 6:06pm UTC](https://resource.dopus.com/t/path-condition-ifpath-without-a-lister/16562/2 "2013-11-14T18:06:44Z")

</div>

Buttons using @ifpath will only work if there is a source path, unfortunately.

Maybe this will work (since ConEmu.exe defaults to the current dir, and lets you run a command via /cmd, and it's OK to run "cd" on its own):

`cd C:\
"C:\Program Files\ConEmu\ConEmu.exe" /cmd cd {sourcepath}`

If that doesn't work, I'd probably use a little external script, passing {sourcepath} to it and having it decide what to run.

We'll probably have a more flexible version of @ifpath in a future version.

---

<div class="post-metadata">

**Author:** ![Dinkelhopper](https://resource.dopus.com/letter_avatar_proxy/v4/letter/d/bc79bd/32.png) [@Dinkelhopper](https://resource.dopus.com/u/Dinkelhopper)\
**Post date:** [November 15, 2013, 11:00am UTC](https://resource.dopus.com/t/path-condition-ifpath-without-a-lister/16562/3 "2013-11-15T11:00:13Z")

</div>

It does not work ☹

I will try a script 🙂

Thanks leo

---

<div class="post-metadata">

**Author:** ![steje](https://resource.dopus.com/user_avatar/resource.dopus.com/steje/32/26008_2.png) [@steje](https://resource.dopus.com/u/steje)\
**Post date:** [November 15, 2013, 3:19pm UTC](https://resource.dopus.com/t/path-condition-ifpath-without-a-lister/16562/4 "2013-11-15T15:19:30Z")

</div>

If @ifpath doesn't work without a lister - try other tests to achieve what you want:

This example worked for me:

`@ifset:STATE=Source 
"C:\Windows\System32\cmd.exe" /s /k pushd {sourcepath}
@ifset:else
"C:\Windows\System32\cmd.exe" /s /k pushd C:\`  
...obviously, there is no SOURCE state if there is no lister.

HOWEVER, a possible gotcha that probably would have tripped you up even if your @ifpath attempt had worked, is that if there IS a lister window open (or even several), but minimized or otherwise just not in focus - and you hit your hotkey INTENDING for a command prompt to open to C:\ because no lister was on top... it wouldn't work. It would probably open the command prompt to whatever folder you have open in whatever lister is currently recognized as the SOURCE.

---

<div class="post-metadata">

**Author:** ![steje](https://resource.dopus.com/user_avatar/resource.dopus.com/steje/32/26008_2.png) [@steje](https://resource.dopus.com/u/steje)\
**Post date:** [November 15, 2013, 3:22pm UTC](https://resource.dopus.com/t/path-condition-ifpath-without-a-lister/16562/5 "2013-11-15T15:22:48Z")

</div>

Note: if the gotcha above is in fact an issue for you - you could probably handle this very easily via an AutoHotkey script and key-binding...

---

<div class="post-metadata">

**Author:** ![Dinkelhopper](https://resource.dopus.com/letter_avatar_proxy/v4/letter/d/bc79bd/32.png) [@Dinkelhopper](https://resource.dopus.com/u/Dinkelhopper)\
**Post date:** [November 17, 2013, 12:08am UTC](https://resource.dopus.com/t/path-condition-ifpath-without-a-lister/16562/6 "2013-11-17T00:08:55Z")

</div>

Hey, this works fine 🙂👍

`@ifset:STATE=Source 
"C:\Program Files\ConEmu\ConEmu64.exe" /Dir {sourcepath}
@ifset:else
"C:\Program Files\ConEmu\ConEmu64.exe" /Dir C:\`

Thanks a lot ❗❗❗
