Installing to D drive and running commands

You have trouble using InstallForge? Then this is the right place for you.
Post Reply
sunghoon.kim.my
Posts: 2
Joined: Mon Jun 20, 2016 4:02 am

Hi, Firstly I would like to thank the developer for this wonderful tool.
I have tried many different installlers in search of one that suits my requirement.

I need to install a program and then I will have some config files(json files) copied to userprofile folder.

Installation of program worked fine and I have a batch file run after the installation which archives existing config files and copy new ones.

The problem arose when I was trying to run a batch script(converted to exe) after installing the program to D drive.

The command I ran are:
MKDIR %USERPROFILE%\AppData\Roaming\ProgName
COPY /Y "<InstallPath>\jsonfiles\config.json" "%USERPROFILE%\AppData\Roaming\ProgName"
cd "<InstallPath>\jsonfiles" & batchrun.exe

Above commands run separately and worked fine when the program was installed to C drive.
But when user decides to install on D drive, the {cd "<InstallPath>\jsonfiles" & batchrun.exe} line fails.
The command actually runs like this when I ran process monitor to track the activities.

Command line: C:\Windows\system32\cmd.exe /c cd "D:\Program Files (x86)\ProgName\jsonfiles" & batchrun.exe

The batchrun.exe will run "set installfolder=%cd%" to store the location of where the program was installed so it can go back and forth the %USERPROFILE% folder and <InstallPath> folder.

(The reason why I did this was because the pushd and popd did not work)

Looking at the command that is run, obviously there is no change of drive letter.
And I do not know how to run a command to say something like {cmd.exe /c D: & cd "D:\Program Files (x86)\ProgName\jsonfiles" & batchrun.exe}

As long as I can tell the batch script where the program is installed, I can workout a solution.
I must find a way to know the installation is against the D: and not C:, then run the D: or C: to change the drive letter.

Is there a way to store this installation path somewhere and call it from commandline? That would work as well.


Thanks in advance.

Kim
User avatar
Soner
Posts: 146
Joined: Mon Sep 15, 2014 12:36 pm

Hello,
you need to run cd with an optional parameter: /d (e.g. cd /d "D:\Myfolder")
This will make the command change the drive.
Best regards,
Soner Boztas, M.Sc. Aerospace Engineering

Add me on LinkedIn: https://www.linkedin.com/in/soner-boztas-engineer
sunghoon.kim.my
Posts: 2
Joined: Mon Jun 20, 2016 4:02 am

you need to run cd with an optional parameter: /d (e.g. cd /d "D:\Myfolder")
This will make the command change the drive.
Thanks! That did the trick.
Post Reply