I can delete files in shell when in the directory, but I get a File not found error from outside the directory - shell

I know this is a rudimentary question, but I am dumbfounded.
Let us say that I have two files in the following directory structure:
C:\Program Files\Program\Directory\Subdirectory\one.txt and C:\Program Files\Program\Directory\Subdirectory\Subsubdirectory\two.txt
When I run the following command in shell, I get File not found errors...
del C:\Program Files\Program\Directory\Subdirectory\one.txt C:\Program Files\Program\Directory\Subdirectory\Subsubdirectory\two.txt
I have also tried wrapping the file path and names in quotes with no success.
I have also tried a simple test on two files sitting on a user desktop without success: C:\Users\User\Desktop\one.txt and ...\two.txt etc.
For reference, I want to push a script which will remove the maintenance and update functionality from Firefox to prevent users from getting update messages etc, automatic updates and to break the functionality should someone find out how to try [I am also running mKiosk extension], and I want to push the script using SOTI MobiControl software.

You have spaces in your command path. You need to quote your arguments:
del "C:\Program Files\Program\Directory\Subdirectory\one.txt"

I have not found a solution to this syntax issue - however the problem is solved by the functionality of the SOTI Mobicontroler software.
In the package/script delivery, I am writing individual del commands for each file. SOTI appears to handle each script line one at a time and sequentially.

Related

Windows 10: Can't make backup file (add ! to override)

This is not a duplicate of:
Vim error E510: Can't make backup file (add ! to override), there are no spaces before or after my equal signs
Cannot create backup file(add ! to overwrite)
My .vimrc in Windows is located at C:\Proram Files (x86)\Vim\_vimrc.
I've added:
set undodir="C:/Program Files (x86)/Vim/undo//"
set backupdir="C:/Program Files (x86)/Vim/backup//"
set directory="C:/Program Files (x86)/Vim/swp//"
I have:
Created the directories in question
Ensured that my user has write permissions for the directory and every file in said directory
Tried different formats for the directory, including using / instead of \, omitting // at the end of the directory, and escaping the spaces in Program Files (x86)
Despite all of this I still receive an E510 error upon saving. Can anyone help out? Doing things on Windows is so amazingly frustrating. :l

Why does this batch file fail for some users?

I have a batch file that copies the most recent version of an access front-end file to the user's C: drive and then opens it from there.
For some users, the copy command causes the batch file to close, and I can't work out what could cause that. The file seems to copy, but the batch file just closes itself without any visible error messages.
I've used Pause to confirm that the failure happens at the Copy step, not the Run or the If.
This is Windows 7, I've tried it with Copy and Xcopy. The users with the issue say it's worked in the past, they all have access to the location being copied from (and to). Mapping the location doesn't seem to make any difference, and UNC paths work for most users so it's not that.
Deleting the existing files in C:\databases doesn't help.
if not exist "C:\Databases\" mkdir "C:\Databases"
copy "\\SERVER02\FINOPS\COMMAQR\DIGIHUB\1. Live Version\DIGIHUB v2.5.accdb" "C:\Databases\"
start [the file]
For 95%+ of users, the batch file copies the most recent version down and opens the file. For a handful, the batch file reaches the copy step and closes itself.
Does anyone know why this could happen, or alternatives to both Copy and XCopy that might not fail?

Deleting a directory without looking inside

I have a directory in my hard drive which causes a bug that opening this directory opens itself again and again in a loop. And this goes on until computer freezes. I have tried with several program and couldn't remove it. Is there a command line command that removes directory without ever looking inside it so, i can get rid of this file.
I am looking for any solution than formatting my hard drive, doesn't have to be command
Thank you
Write a C++ code using this library
https://msdn.microsoft.com/en-US/library/67y3z33c(v=vs.80).aspx
and edit that directory with the code

install4j: Executing bash file

I am trying to run a bash file from install4j6. install4j does indeed try to run the bash file but it just returns an error at the end of the installation. The error is very generic and has no code reference or anything that will help me determine a solution - just a message that says "Error while executing file."
The only thing I can provide is how I have it setup in install4j6 since I am pretty sure that's my issue.
The bash file is defined in the root of my installation directory distribution tree and is named set_permissions.sh. For the sake of eliminating permissions being a cause, the file permission mode is set to 777 (both in install4j and on the file system).
I believe the issue is related to what I have set as my "working directory". I currently have it set to just ".". Is there a way to debug this further? Maybe get an actual error as to why it's not executing?
Ok, first a few things to check:
make sure that you're running the batch file after the install files step (you mention it being at the root of your install)
best to have the wait for termination checked and a variable for the return code.
redirect stderr to the log file (just in case)
As for working directory, . should work, but you can change it to ${installer:sys.installationDir} to make sure that it references the installation directory chosen by the user. You can also set the executable in the form of ${installer:sys.installationDir}\set_permissions.sh
Also, try and run just your shell script to make sure that it works :)

Recommended Library/Macro that Deletes Installed Files on Uninstallation

Which library or macro that deletes only installed files when the uninstallation is run would you recommend?
I'm aware this kind question has been asked alot but I'm looking for advice on the most current and easiest to use macro/library. As in the past,I used old macros that were posted on NSIS Website for things like Command Line Argument parsing and had problems with the code and implementation.
My understanding is that there are 2 so far(are there more?):
Advanced_Uninstall_Log
Uninstall_only_installed_files
Which library or single macro do you use and recommend?
I am hoping that I am able to install files by only specifying a folder X(and all its sub files will be installed) and the uninstaller will then delete all the subfiles in folder X but leave any the user created.
For eg:
Section "install"
File \r "FolderX"
# note how I dont do this..
File \r "FolderX\filea.txt"
File \r "FolderX\fileb.txt"
SectionEnd
Section "un.uninstall"
${RemoveDir} "FolderX"
# The above hypothetical function will hopefully only delete the files in FolderX that I installed.
Delete \r "FolderX\filea.txt"
Delete \r "FolderX\fileb.txt"
SectionEnd
I tried both of the above mentioned, and neither worked for me. The Advanced_Uninstall_Log worked well, but for the amount of data I had it added a huge delay during the install.
The uninstall_only_installed_files isn't for doing recursive install with file /r.
I ended up writing a python script that created two macros, InstallFiles and UninstallFiles. I use a batch file to call this script and generate an install_files.nsh prior to building the NSIS installer with MakeNSIS.
Someone posted his similar script here; http://nsis.sourceforge.net/Talk:Uninstall_only_installed_files

Resources