Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 887807
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T13:17:27+00:00 2026-05-15T13:17:27+00:00

I am trying to modify a batch script that installs a simple script file

  • 0

I am trying to modify a batch script that installs a simple script file into the users photoshop directory.

The basic process of the installer is to copy the bulk of the products files into the %APPDATA% folder, then this batch script runs post-install that copies a little hook script into photoshop\presets\scripts. However we’ve run into issues with %APPDATA% not being defined on some customers machines, would it be bad practice to check if it exist then set it if not, and if not how would you best set it accounting for different versions of Windows?

I’ve also taken a pretty bumpy ride down the ‘reg query’ road to try and find a consistent key that photoshop sets in order to find the “Path” which is the install directory but I’m wondering what the best-practices for that are as well.

Here’s my current working version that has some vista permission relics

    @echo off
rem | locate photoshop by querying the registry
echo Locating your photoshop installation..
set regpath="HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\Photoshop.exe"
set regval="Path"
set photoshop_path=

rem | accumlate the path from the query
for /f "tokens=2,* delims= " %%A in ('reg query %regpath% /v %regval%') do ( 
    set photoshop_path=%%B 
)

rem | get rid of the last hanging space
set photoshop_path=%photoshop_path:~0,-1%

echo found photoshop at %photoshop_path%

set script_path=%photoshop_path%Presets\Scripts\script.jsx

echo Removing existing copies of script.jsx..
if exist "%script_path%" del "%script_path%"
echo ...Done!

echo Installing script.jsx to Photoshop Scripts directory... %script_path%
if exist "%photoshop_path%Photoshop.exe copy "%APPDATA%\My Company\etc\script.jsx" "%script_path%"
echo Done!

rem | some fix for vista permissions
ver | find "XP" > nul
if %ERRORLEVEL% neq 0 goto exit

echo Setting permissions for Vista...
echo ...Taking ownership of files...
takeown /f "%APPDATA%\My Company" /r /d y
echo ...Granting write access to files...
icacls "%APPDATA%\My Company" /grant Users:F /t
echo Done!

:exit

echo Creating Product Library entry in folderlist.cfg
echo Product Library=%APPDATA%\My Company\library>>"%APPDATA%\My Company\etc\folderlist.cfg"
echo Done!

However, problems arise when the key doesn’t exist, the current solution that is deployed just brute force tries every known location photoshop might be installed (based on the %PROGRAMFILES%/%PROGRAMFILES(x86)% variables. Any help towards a more robust and consistent script is much appreciated as well as any advice on what installer products might work best for deploying this type of script in a cross-platform manner(Mac/Windows mostly).

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-15T13:17:27+00:00Added an answer on May 15, 2026 at 1:17 pm

    Well, I basically solved this problem by writing a completely new installer using Inno setup. It rocks. It uses pascal which feels a little archaic to me but it was much easier to pickup and use than batch scripting. Somebody please write a python installer api!

    As far as best practices go for locating a user’s installation of photoshop(or any program for that matter), it seems like the brute force method of simply trying every possible key/directory it might be located in is the best bet.

    For instance, when I installed photoshop recently, it actually gave me 2 installations in 2 separate folders, a 32 bit and 64 bit version. Ideally, when I run my installer to add things to photoshop’s directory, it should go into both versions. It wouldn’t do that if I simply queried some ‘master registry key’ and stuffed it in there. It seems that, over the years, even a big name like Adobe hasn’t used the registry in a consistent manner. So, the best chance my installer has of working is making a big list of every possible registry key adobe has made for the installation path of photoshop and trying all of them, and then also trying raw directories myself (based on environment variables at least). If only people followed standards!

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

No related questions found

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.