Software distribution:How to do can change the default execution path

Software distribution of a .bat file,
test.bat content is to create a directory The following:

md testFolder

action script

copy __Download\test.bat "c:\test.bat"
wait cmd /Q /C "c:\test.bat"

I mean file to disk C, create a new folder in the bat, So c:\testFolder,
The system default execution from “C:\Program Files (x86)\BigFix Enterprise\BES Client__BESData\actionsite”, the result is so :

How can switch to the directory in the script of the operation, not change .bat command

folder create "C:\testFolder"
copy __Download\test.bat "c:\testFolder\test.bat"
wait cmd /Q /C "c:\testFolder\test.bat"

Personally I favour not assuming static drive letters so would tend to use a dynamic lookup for the drive of system folder

folder create "{name of drive of system folder}\testFolder"
copy __Download\test.bat "c:\testFolder\test.bat"
wait cmd /Q /C "c:\testFolder\test.bat"

Another option is to not download the batch file but create it on the fly, that way a simple change to the fixlet action you can modify the BAT file which makes things easier when those small changes to the BAT file crop up. It would really depend on whichever is best for your requirements, eg

createfile until end_of_file
echo running batch file
REM add whatever other batch command you need
end_of_file
folder create "{name of drive of system folder}\testFolder"
delete "{name of drive of system folder}\testFolder\test.bat"
copy __createfile "{name of drive of system folder}\testFolder\test.bat"
wait cmd /q /c "{name of drive of system folder}\testFolder\test.bat"

Thank You,using dynamic way,

bat file code,Is called a CMD command

cmd.exe

I have a situation here is that by default bat file are carried out through here,

I want to achieve is so, is that ok? Now that directory is copied to the other, is there a way through the other paths, like this Under

If the call directory is the target directory “C:\testFolder”, you can also easily deal with the other files in the directory .

Just want to have any script can switch so directory.

thank you.

You should be using BigFix to copy the installation files and scripts to the client – having it in another folder means you are doing it through group policy or some other fashion and is probably not the best approach.

That being said, as you have noticed the working directory is that …\Actionsite folder. You have an option if you dont want the working directory to be that folder:

call the installer from a batch script and cd to the directory from within the batch script:

delete __createfile
delete run.bat

createfile until _end_
@ECHO OFF
cd "C:\testfolder"

call install.bat

_end_

move __createfile run.bat

override wait
hidden=true
completion=job
wait run.bat
1 Like

Are you sure that works? I thought the working directory reset with every call.

1 Like

Edited my reply – for some reason my test case wasn’t accurate :slight_smile:

2 Likes

You had me worried. Have I been doing it the hard way all of these years? Is this new functionality? Is it a bug? What is the /s switch… is it magical?

Thank you, I’ll try
This problem bothering me for a long time ,

“/s” IS Magic!

In my opinion, it makes quote handling over the cmd command line easier so that if you have a path with spaces in it and you need to put quotes around the path, cmd won’t break :slight_smile:

2 Likes

Thank you, I use your method is successful,
I’m thinking of a different kind of problems at the same time, this kind of situation is only.bat/.cmd format file is
The. exe/.msi if there is a similar situation?

You’ll use the same format:

delete __createfile
delete run.bat

createfile until _end_
@ECHO OFF
cd "C:\testfolder"

call install.bat

_end_

move __createfile run.bat

override wait
hidden=true
completion=job
wait run.bat

But you’ll swap:

call install.bat

With whatever your command is:

install.exe /s /quiet

or

msiexec /i installer.msi /qn
1 Like

Thank you, I use your method is successful
I’m thinking of a different kind of problems at the same time, this kind of situation is only.bat/.cmd format file is
The. exe/.msi if there is a similar situation?

See my above reply – that should answer your question!

2 Likes

Thank you
Our program is required for the current account permissions to install, I changed your script, it‘s ok,

delete __createfile
delete run.bat

createfile until _end_
@ECHO OFF
cd "C:\testfolder"
BesGroup.exe /s /quiet
_end_

move __createfile run.bat
waithidden __Download\RunAsCurrentUser.exe --w --q cmd.exe /c run.bat /quiet /norestart
1 Like

@leewei 李总,您好,我是来自上海的大伟,之前一直通过邮件向您请教问题的,非常感谢,
刚刚在其他帖子看到您回复的,在这里跟您打个招呼,现在也是试着来这里学习,虽然我的英文不怎么好… :smile: :smile:
以后请多多指教.
谢谢

I’d say your english is above average for a non native speaker, as far as communicating what is really needed here in the forum.


1 Like

@dwerdwer, sorry for not having seen your message to say hello.
I appreciate you using English in spite of the fact that this is not your native language.
I will reply to your email as well.

1 Like