Search the Community
Showing results for tags 'batch'.
Found 3 results
Hi, I am currently working on script that installs some software. The script takes a parameter for a share where if empty it will download these files from the official servers. but if the share tab is not empty it will attempt to download the files from the given share. This is where the problem comes in, the script never seems to be able to download from the share itself and just kind of passes through, without throwing any errors. This is the code the script tries to run to download the files (batch script) @echo off cd "destination" pushd @share@ xcopy /s /i "Office" "destination" popd Where @share@ is the value in the share field. Perhaps I'm passing the share into the script incorrectly, I'm unsure. That is the way it works with a PowerShell script so I assumed the same. both system and anonymous have access to the share. However I cant run the batch script as admin through automate as it breaks. Any help is kindly appreciated. Cheers
DarrenWhite99 posted a topic in Cool ToolsYou can't directly run .ps1 files in remote monitors like you can .vbs and .bat files. But this applies beyond just remote monitors, .ps1 doesn't run universally like .vbs or .bat. A way to get PowerShell portable is to use a .vbs or .bat file to carry the PowerShell script. Here are a couple of ways you can do this: The first is a generic way to embed text files inside a batch script. The embedded files are extracted and saved apart from the script. This example has two simple text files included. (See BATCH-WITH-EMBEDDED-FILEs.bat) The second script method is a way to include PowerShell code directly inside a batch file. This can run anywhere like a batch and the PowerShell is interpreted directly without creating any secondary files. There is a trade-off, the output will not report the correct line number for any failures, and a script crash can result in no useful output. (Output is buffered. Write-Host will be output immediately. Write-Output will buffer until the script completes.) For this reason it is harder to develop and debug PowerShell wrapped in a batch file. So this method works best when you develop and test a PowerShell script as a separate file, and then simply dump the contents to the end of the Batch framework script. (See BATCH-WITH-EMBEDDED-POWERSHELL.bat) I use method 1 when I need to include standalone files and want to move them all with one file. (An example is a batch script that imports a trusted publisher certificate. The certificate is carried inside the batch, but needs to be its own file for importing by certutil.) I use method 2 anytime I want a batch to run PowerShell. Several of my remote monitors in LabTech are .bat wrapped PowerShell scripts. I don't like creating a batch file that only turns around to create a separate PowerShell file. You have two files to clean up, etc. Aside from the starter scripts, I included examples of how I have used both methods in real life. The attachment has been moved. See https://www.labtechgeek.com/files/file/23-powershell-embedding-in-batch/
Hello, I'm trying to run this batch script to uninstall all version of Firefox in Automate but I can't seem to get it to work: taskkill.exe /f /im firefox.exe IF EXIST "%ProgramFiles%\Mozilla Firefox\uninstall\helper.exe" "%ProgramFiles%\Mozilla Firefox\uninstall\helper.exe" -ms IF EXIST "%ProgramFiles(x86)%\Mozilla Firefox\uninstall\helper.exe" "%ProgramFiles(x86)%\Mozilla Firefox\uninstall\helper.exe" -ms IF EXIST "%ProgramFiles%\Mozilla Firefox\uninstall\helper.exe" "%ProgramFiles%\Mozilla Firefox\uninstall\helper.exe" /s IF EXIST "%ProgramFiles(x86)%\Mozilla Firefox\uninstall\helper.exe" "%ProgramFiles(x86)%\Mozilla Firefox\uninstall\helper.exe" /s The batch file alone works if I manually run it on my machine. I've tried the following types of scripts: 1. "Execute Script" pasted the script into the "Script to Execute" window and chose "Run as Admin", Script Type: "Batch". 2. Download and Run script as admin. 3. App Deploy Wizard. Thanks for your help! John