Run program from Button bar
Moderators: white, Hacker, petermad, Stefan2
Run program from Button bar
Hi everyone!
I am a very old TC user (since it was Windows Commander, thus i still launch it via Ctrl+Alt+W combo because i get used to back in the day).
And I registered here for the first time because I got stuck with a strange behavior...
My .cmd batch file, and program that it starts, act differently when they are launched from Button bar and when launched directly by hitting Enter on it in a folder navigation window. When I launch it from button bar click i have an error, when i launch .cmd directly - it's ok. I've checked it several times after 2 reboots... Why? Are there any issues with running file different way?
I use Windows 7 and logged in with admin rights, TC ver. 8.52a (checked with 9.12 - same problem).
Please nudge me in a right direction)
p.s. this is unlikely due to a wrong startup folder, i change dir with cd command at the 1st line of my .cmd file: cd c:\my_path\...
Thank you!
I am a very old TC user (since it was Windows Commander, thus i still launch it via Ctrl+Alt+W combo because i get used to back in the day).
And I registered here for the first time because I got stuck with a strange behavior...
My .cmd batch file, and program that it starts, act differently when they are launched from Button bar and when launched directly by hitting Enter on it in a folder navigation window. When I launch it from button bar click i have an error, when i launch .cmd directly - it's ok. I've checked it several times after 2 reboots... Why? Are there any issues with running file different way?
I use Windows 7 and logged in with admin rights, TC ver. 8.52a (checked with 9.12 - same problem).
Please nudge me in a right direction)
p.s. this is unlikely due to a wrong startup folder, i change dir with cd command at the 1st line of my .cmd file: cd c:\my_path\...
Thank you!
Re: Run program from Button bar
Most likely no one can help you unless you tell us which error you're getting when launching from the button bar. Or, even better, copy the button and paste it here in [code] tags.
Regards
Dalai
Regards
Dalai
#101164 Personal licence
Ryzen 5 2600, 16 GiB RAM, ASUS Prime X370-A, Win7 x64
Plugins: Services2, Startups, CertificateInfo, SignatureInfo, LineBreakInfo - Download-Mirror
Ryzen 5 2600, 16 GiB RAM, ASUS Prime X370-A, Win7 x64
Plugins: Services2, Startups, CertificateInfo, SignatureInfo, LineBreakInfo - Download-Mirror
Re: Run program from Button bar
Dalai, here is the text from DEFAULT.BAR
button37=C:\Windows\System32\imageres.dll,-68
cmd37=c:\_WORK\edc_ui\start.cmd
path37=c:\_WORK\edc_ui\
menu37=start
Here is the content of start.cmd itself:
cd c:\_WORK\edc_ui
npm start
Very simple. 'npm start' launches Node.js server. The problem is that when i launch start.cmd from Button bar i get constant error output in browser. And there are no errors if i launch batch directly or via command prompt.
button37=C:\Windows\System32\imageres.dll,-68
cmd37=c:\_WORK\edc_ui\start.cmd
path37=c:\_WORK\edc_ui\
menu37=start
Here is the content of start.cmd itself:
cd c:\_WORK\edc_ui
npm start
Very simple. 'npm start' launches Node.js server. The problem is that when i launch start.cmd from Button bar i get constant error output in browser. And there are no errors if i launch batch directly or via command prompt.
Re: Run program from Button bar
I know that it sounds strange, but i'm really confused with it.
Re: Run program from Button bar
It is possible to log into my PC via TeamViewer if it may be of help. I can grant it.
Re: Run program from Button bar
"Start" is internal command of cmd.exe. Reusing this name may be misleading. Rename your script to startnpm.cmd, startN.cmd or anything else. Just in case…
Use the /D switch to change current drive in addition to changing current directory for a drive. Suppose you want to click your button when browsing files on pendrive or DVD…
Code: Select all
cd /d c:\_WORK\edc_ui
Andrzej P. Wozniak
Polish subforum moderator
Polish subforum moderator
Re: Run program from Button bar
Hi and welcome d-sphinx
Please right click at the button in the button bar and chose COPY,...... paste that here in.
Also use Ctrl+C on the error dialog (or Ctrl-A + Ctrl-C on the error output in browser) and post that also here.
There is no problem in naming a batch START.cmd for to launch that batch (ok, may be depend on the used OS),
but not using well know names is definitive a good idea,
for example the need to use the internal command START in the directory with that batch in may not work as expected.
But probably you have space in your real path and you didn't use quotes there.
So please post your real command details and not modified examples only.
Also you can modify your start.cmd to:
and check there the error message and post that here.
Please right click at the button in the button bar and chose COPY,...... paste that here in.
Also use Ctrl+C on the error dialog (or Ctrl-A + Ctrl-C on the error output in browser) and post that also here.
There is no problem in naming a batch START.cmd for to launch that batch (ok, may be depend on the used OS),
but not using well know names is definitive a good idea,
for example the need to use the internal command START in the directory with that batch in may not work as expected.
But probably you have space in your real path and you didn't use quotes there.
So please post your real command details and not modified examples only.
Also you can modify your start.cmd to:
Code: Select all
@ECHO OFF
cd "c:\_WORK\edc_ui"
npm start
PAUSE
Re: Run program from Button bar
Ok, here it is:Please right click at the button in the button bar and chose COPY,...... paste that here in.
Code: Select all
TOTALCMD#BAR#DATA
c:\_WORK\edc_ui\startNPM.cmd
C:\Windows\System32\imageres.dll,-68
start
c:\_WORK\edc_ui\
-1
Here is the script console output after running by hitting Enter on it in navigation window:
Image: https://i.imgur.com/RQ1PaZo.png
Here is the output after clicking on a Button bar:
Image: https://i.imgur.com/M5JhSJa.png
They are the same (except the height of drive letter C: - don't know why).
But - the result is different! Running directly starts server normally:
Image: https://i.imgur.com/K87Onyu.png
Running via Button bar's shortcut:
Image: https://i.imgur.com/FNt42LJ.png
Re: Run program from Button bar
One little guess: do running programs from toolbar affect environment variables? Like node_env=production
If yes it may be the reason.
If yes it may be the reason.
Re: Run program from Button bar
Thanks for the detail information.
In TC start a DOS console ( menu Commands > open command prompt)
and type SET + enter
or even SET nod + enter
Please note: different users (a elevated admin f.ex. is) have different environments. Just in case...
In TC start a DOS console ( menu Commands > open command prompt)
and type SET + enter
or even SET nod + enter
Please note: different users (a elevated admin f.ex. is) have different environments. Just in case...
Re: Run program from Button bar
Maybe it is a problem with different environments if 64-bit OS and 32-bit TCmd is used.
"War is evil, in so far as it makes more bad people than it takes away."
Immanuel Kant in "Perpetual Peace"
Immanuel Kant in "Perpetual Peace"
Re: Run program from Button bar
Get Process Explorer or Process Hacker and take a close look at the process details of the running server (one after the other).
Are you sure you use the exact same batch file that's used in the button bar? Does it have the same working directory?
Grüße
Dalai
Are you sure you use the exact same batch file that's used in the button bar? Does it have the same working directory?
Grüße
Dalai
#101164 Personal licence
Ryzen 5 2600, 16 GiB RAM, ASUS Prime X370-A, Win7 x64
Plugins: Services2, Startups, CertificateInfo, SignatureInfo, LineBreakInfo - Download-Mirror
Ryzen 5 2600, 16 GiB RAM, ASUS Prime X370-A, Win7 x64
Plugins: Services2, Startups, CertificateInfo, SignatureInfo, LineBreakInfo - Download-Mirror
Re: Run program from Button bar
Dalai, i'm sure that use exact same file in each scenario.
Working directory also the same, moreover i change it explicitly on the 1st line of script - just to be sure:
@ECHO OFF
cd /d "c:\_WORK\edc_ui"
cd
pause
clear
set
pause
npm start
PAUSE
As for the Process Hacker I can't see anything unusual between two runs, except minor differences in memory consumption but this is expected - cause server refuses to work with client on one run and runs on another...
Stefan2, I already checked - environment is the same for both runs.
The ONLY visual difference in console output I got so far is "c:" and "C:" in path but this is ridiculous. Anyway - the server _launches_ both ways, so path hardly to be the reason. If i had, lets say, Cyrillic C instead of Latin - it wouldn't launch at all just at the start.
Working directory also the same, moreover i change it explicitly on the 1st line of script - just to be sure:
@ECHO OFF
cd /d "c:\_WORK\edc_ui"
cd
pause
clear
set
pause
npm start
PAUSE
As for the Process Hacker I can't see anything unusual between two runs, except minor differences in memory consumption but this is expected - cause server refuses to work with client on one run and runs on another...
Stefan2, I already checked - environment is the same for both runs.
The ONLY visual difference in console output I got so far is "c:" and "C:" in path but this is ridiculous. Anyway - the server _launches_ both ways, so path hardly to be the reason. If i had, lets say, Cyrillic C instead of Latin - it wouldn't launch at all just at the start.
Re: Run program from Button bar
Did you check the process details by double-clicking on it? There you should take a look at the environment variables, the working (current) directory and elevation status (or user name).
If there's no difference, try the latest TC version (currently 9.22a) and/or TC 64-bit. If that doesn't change anything, I'm out of ideas.
Regards
Dalai
#101164 Personal licence
Ryzen 5 2600, 16 GiB RAM, ASUS Prime X370-A, Win7 x64
Plugins: Services2, Startups, CertificateInfo, SignatureInfo, LineBreakInfo - Download-Mirror
Ryzen 5 2600, 16 GiB RAM, ASUS Prime X370-A, Win7 x64
Plugins: Services2, Startups, CertificateInfo, SignatureInfo, LineBreakInfo - Download-Mirror
Re: Run program from Button bar
If you want to change that try one or both of these INI-Parameters
DrivesExportUpcase=
DrivesShowUpcase=
From the Help > Configuration and Switches > Ini file Settings
Needs an restart of TC.Total Commander 7.50 Public Beta 2
26.04.09 Added: wincmd.ini [Configuration] DrivesShowUpcase=1
shows drives with uppercase drive letters in drive bar, drive dropdown list,
current dir, tabs and to the left of the command line
26.04.09 Added: wincmd.ini [Configuration] DrivesExportUpcase=1
exports paths with uppercase drive letters in functions like Mark - Copy to clipboard with full path,
and when launching programs (current dir, program name)
Note: The location of the ini files can be seen in menu Help - About Total Commander.
If entry doesn't exists, just create them below of [Configuration]
Find me: upper case drive letter C: .... lower case drive letter c: ...... ucase upcase drive