EthenHY
EthenHY

Reputation: 551

How to get the cmd file out of bin folder

Here is a quick question, when you use start up task, you need to put the cmd line in bin folder.

So if I don't want to put them in bin folder If I want to put it in solution folder what should I do.

Upvotes: 2

Views: 264

Answers (1)

larrydahooster
larrydahooster

Reputation: 4163

The execution path of the Start-Up Tasks is not configurable and properly set in some precompiled enviroment dlls. It is set to "approot\bin" for Web roles, and "approot" for Worker roles.

I don't know whether it is good practice or not and rather would not recommend it, but i also had done some research on it and found out, that you can define the Startup Task with relative folder path:

<Task commandLine="../init-bla.cmd" executionContext="elevated" taskType="background" />

This will run the init-bla.cmd from approot. But be aware: The context of the cmd stays in the bin folder.

For example, if you want to output something to a file or call another file, you have to be aware of the execution context. This example-code creates the output.txt file into bin folder, although it runs from approot.

@echo off
ECHO I_WAS_CALLED_ON_STARTUP >> output.txt

EXIT /B 0

Upvotes: 2

Related Questions