Running a BAT file from a BAT file issue

Scorpion Ghost

Elite Member
Executive VIP
Jr. VIP
Joined
Mar 22, 2013
Messages
9,146
Reaction score
10,489
So I use a BAT file to run programs, it works great. But now I'm trying to start a BAT file with a BAT file, and I get errors:

This is the code I'm trying to run:

Code:
@ECHO off
Timeout /T 3
start C:\"Users"\"user"\"Desktop"\"Tools"\myfile.bat
Timeout /T 5

When I run it, I get this:

C:\Users\user\Desktop>call checkdeps.bat
'checkdeps.bat' is not recognized as an internal or external command,
operable program or batch file.

C:\Users\user\Desktop>node.exe bla.js myfile
'node.exe' is not recognized as an internal or external command,
operable program or batch file.


I can run the "myfile.bat" just fine when I double click on it.

How can I do this? Thanks
 
C:\Users\user\Desktop>call checkdeps.bat
'checkdeps.bat' is not recognized as an internal or external command,
operable program or batch file.

C:\Users\user\Desktop>node.exe bla.js myfile
'node.exe' is not recognized as an internal or external command,
operable program or batch file.

Where are you running the BAT file from?

It's obviously a problem of the script not being able to find the things it needs.

Also let's say the code you provided is in a file called "parent.bat", try to put parent.bat in the same folder as myfile.bat and see if it runs correctly.

EDIT:
A quick fix would be to put the full path to checkdeps.bat and node.exe instead of just their names.
 
Where are you running the BAT file from?

It's obviously a problem of the script not being able to find the things it needs.

Also let's say the code you provided is in a file called "parent.bat", try to put parent.bat in the same folder as myfile.bat and see if it runs correctly.

EDIT:
A quick fix would be to put the full path to checkdeps.bat and node.exe instead of just their names.

Well, when I get it working I will be running the BAT from the Windows "Startup" folder. And by that I mean the PC would restart, and when it starts up it will run the BAT file on its own. This works fine for starting Firefox browsers and Autoit scripts and other programs by the way.

But in this case I'm running it from the Desktop.

So I'm no expect, but I don't actually run checkdeps.bat and node.exe. I just run the "myfile.bat", and that file seems to then start/use checkdeps and node.
 
Well, when I get it working I will be running the BAT from the Windows "Startup" folder. And by that I mean the PC would restart, and when it starts up it will run the BAT file on its own. This works fine for starting Firefox browsers and Autoit scripts and other programs by the way.

But in this case I'm running it from the Desktop.

So I'm no expect, but I don't actually run checkdeps.bat and node.exe. I just run the "myfile.bat", and that file seems to then start/use checkdeps and node.

Ok so the errors are telling you that it can't find checkdeps.bat and node.exe.
Since it works when you double click I guess you have both, so it's a problem of relative paths.

Try this and see if it works:
Code:
@ECHO off
Timeout /T 3
cd "C:\Users\user\Desktop\Tools\" && start myfile.bat
Timeout /T 5

Remember to replace user and myfile.
 
Last edited:
Try this and see if it works:
Code:
@ECHO off
Timeout /T 3
cd "C:\Users\user\Desktop\Tools\" && start myfile.bat
Timeout /T 5

Remember to replace user and myfile.

Yeeeeeeeeeah. It worked. Thanks bro! :cool:
 
Back
Top