Access path with percent char: C:\PHOTOSHOP\CSDATA\%AppData%

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
budhax
Posts: 63
Joined: 09 Oct 2006 12:25

Access path with percent char: C:\PHOTOSHOP\CSDATA\%AppData%

#1 Post by budhax » 16 Jul 2007 16:51

Hello,
Some portable softwares have sub-folders named like %AppData%
i.e. percent char in the name.

Portable Adobe Photoshop CS3 Standard (folder structure)
_ CSDATA
__ %AppData%
___ Adobe
____ Adobe Photoshop CS3
_____ Adobe Photoshop CS3 Settings
_____ - Actions Palette.psp (19.65 kilobyte)
_____ - Adobe Photoshop CS3 Prefs.psp (152.14 kilobyte)
_____ - Color Settings.csf (712.23 kilobyte)
_____ - LaunchEndFlag.psp (12 bytes)
_____ - PluginCache.psp (798.37 kilobyte)



How to access this path:
C:\Program Files\Adobe\PHOTOSHOP\CSDATA\%AppData%\Adobe\Adobe Photoshop CS3\Adobe Photoshop CS3 Settings

using commands like:

Code: Select all

dir
cd
xcopy

?

Another problem: %AppData% is a predefined variable.
echo %AppData%
outputs
C:\Documents and Settings\sam\Application Data

Thanks

mytest.bat

Code: Select all

@ECHO OFF
SET Folder=C:\Program Files\Adobe\PHOTOSHOP\CSDATA\%AppData%\Adobe\Adobe Photoshop CS3\Adobe Photoshop CS3 Settings
CD "%Folder%"
DIR "%Folder%"
Pause

DosItHelp
Expert
Posts: 239
Joined: 18 Feb 2006 19:54

#2 Post by DosItHelp » 16 Jul 2007 23:09

budhax,

Try:

Code: Select all

SET "Folder=C:\Program Files\Adobe\PHOTOSHOP\CSDATA\^%AppData^%\Adobe\Adobe Photoshop CS3\Adobe Photoshop CS3 Settings"


That should do ;)

budhax
Posts: 63
Joined: 09 Oct 2006 12:25

#3 Post by budhax » 18 Jul 2007 16:10

Sorry,
It doesn't work. But this works fine:

Code: Select all

SET FoldPC=C:\Program Files\Adobe\PHOTOSHOP\CSDATA\%%AppData%%\Adobe\Adobe Photoshop CS3\Adobe Photoshop CS3 Settings
DIR "%FoldPC%"
CD "%FoldPC%"
DIR
Pause


So, use %% instead of single % in path using %

Thanks anyway.

DosItHelp
Expert
Posts: 239
Joined: 18 Feb 2006 19:54

#4 Post by DosItHelp » 20 Jul 2007 22:11

budhax,

Strange, on the command line it's the other way around: ^% works but %% doesn't. I tried on the command line and made a bad assumption.

Post Reply