I'm using installutil to install a service. However, when I copy the entire folder
- msawebservice
- install.bat
- MSAGRadWebService
- MSAGradWebService.exe
- msawebservice - Copy
- install.bat
- MSAGRadWebService
- MSAGradWebService.exe
The install.bat in the first msawebservice folder works, but when I run the install.bat in the msawebservice - copy, I get the System.IO.FileLoadException : Could not load file or assembly 'file:Path-to-msawebservice'. So it is trying to reference the old folder. But when I change the original folder name it still works correctly. Here is the bat file:
#ECHO OFF
REM The following directory is for .NET 4.0
set DOTNETFX4=%SystemRoot%\Microsoft.NET\Framework64\v4.0.30319
set PATH=%PATH%;%DOTNETFX4%
echo Installing MSAGradWebService...
echo ---------------------------------------------------
InstallUtil /i %~dp0\MSAGradWebService\MSAGradWebService.exe
echo ---------------------------------------------------
pause
echo Done.
What I have tried:
Unblocking the files
The issue with this was that there was a space in the PATH. The PATH needs to be between "..."
Related
imagine I have a files with certain extensions (for example '.abc').
The default program I set for files with this special extension is a batch script with powershell commands in it, so when I doubleclick the file, it runs the script. It works.
Now my question is, can I somehow get the file path of the .'abc' file I opened? Is there a command for this?
Thank you.
Inside of your batch file it should be possible to access the ".abc" file via parameter %1.
Per default Windows sends the filename of the file you doubleclick to the receiving program (or batch script) as parameter one.
Try this inside of your batch file (near the top) and pick what suits your needs:
echo param1: %1
echo param1 unquoted: %~1
echo drive: %~d1
echo drive and path: %~dp1
echo filename and extension only: %~nx1
set myparam=%~1
echo myParam: %myparam%
See the help documentation of for for the "%~..." syntax by executing for /? in a cmd.exe command window. (Or read here: What does %~dp0 mean, and how does it work?)
I'm working through a coding tutorial/book called Curious Moon. One of the assignments is to normalize and load data from a CSV file put in a Postgres table. The database name is "enceladus" and the table name is "master_plan". I was told to use make to do this. I can't figure out how to run the Makefile in PowerShell.
I installed GNUWin32 with make.exe on my Windows laptop running Windows 10. I used PowerShell to run make.exe. I did this by running notepad $profile and saved New-Item alias:make -Value 'C:\Program Files (x86)\GnuWin32\bin\make.exe' in the file. I gave it a new alias because I was getting an error message. Now when I'm calling the alias like this:
PS C:\Users\Sabrina> make
I'm getting this error:
make: *** No targets specified and no makefile found. Stop.
I wrote the Makefile in sublime and saved it as a makefile extension. It's in the same folder 'C:\Program Files (x86)\GnuWin32\bin' as make.exe and named Makefile. I tried running it as
PS C:\Users\Sabrina> make -f Makefile
and then I get the error
make: Makefile: No such file or directory
I'm not sure how to get the makefile to open and run.
This is my code in the Makefile:
DB=enceladus
BUILD=${CURDIR}/build.sql
SCRIPTS=${CURDIR}/scripts
CSV='${CURDIR}/data/master_plan.csv'
MASTER=$(SCRIPTS)/import.sql
NORMALIZE = $(SCRIPTS)/normalize.sql
all: normalize
psql $(DB) -f $(BUILD)
master:
#cat $(MASTER) >> $(BUILD)
import: master
#echo "COPY import.master_plan FROM $(CSV) WITH DELIMITER ',' HEADER CSV;" >> $(BUILD)
normalize: import
#cat $(NORMALIZE) >> $(BUILD)
clean:
#rm -rf $(BUILD)
Makefile is in C:\Program Files (x86)\GnuWin32\bin, but you're current working directory is C:\Users\Sabrina. When running make or make -f Makefile the command is looking for a Makefile in the current working directory, not in the directory where the executable resides.
Put the Makefile into your current working directory and the problem will disappear.
Move-Item 'C:\Program Files (x86)\GnuWin32\bin\Makefile' .
make
I need to fix the the name of the Users Thunderbird profile folder located in C:\Users\%USERNAME%\AppData\Roaming\Thunderbird.
To do this, I've made a batch script wich changes the xxxxx.default created at the Thunderbird first launch in :
The profiles.ini file
The path of the roaming folder (see below)
All occurrences in prefs.js file
The name of the "Local profile" folder
But even with this, Thunderbird creates another xxxxx.default folder when I start it after running my script.
My question is : why ? What missed I ? Is there another location where I must change the xxxxx.default ?
Thanks
Auto answer :
I had to change the name of the folder located in C:\Users\%USERNAME%\AppData\Roaming\Thunderbird by a name of my choice (mv command).
Then, I created a new profile.ini file with this folder path (echo to a file command). All the rest (prefs.js for example) is made automatically by Thunderbird on the first startup.
1 step : Identify the name of the random directory using DIR command and store it into a variable :
DIR "C:\Users\%USERNAME%\AppData\Roaming\Thunderbird\Profiles" /ad /b > temp.txt
SET /p PROFIL_FOLDER= < temp.txt
2 step : Change the random folder name :
MV "C:\Users\%USERNAME%\AppData\Roaming\Thunderbird\Profiles\%PROFILE_FOLDER%" "C:\Users\%USERNAME%\AppData\Roaming\Thunderbird\Profiles\NEW_DIR"
3 step : Write a new profiles.ini file :
INI_FILE="C:\Users\%USERNAME%\AppData\Roaming\Thunderbird\Profiles.ini
ECHO [General]>%INI_FILE%
ECHO StartWithLastProfile=^1>>%INI_FILE%
ECHO [Profile0]>>%INI_FILE%
ECHO Name=default>>%INI_FILE%
ECHO IsRelative=^0>>%INI_FILE%
ECHO Path=C:\Users\%USERNAME%\AppData\Roaming\Thunderbird\Profiles\NEW_DIR>>%INI_FILE%
ECHO Default=^1>>%INI_FILE%
All of these is to put in a batch file wich is launched at the startup session.
Basically just attempting to create a very basic program that will display the last modified date of a file on our server. Problem is I have no idea how to write it. This is what I attempted
cd \\Server\Folder
msg dir
I also ran into the problem "CMD Does not support UNC Paths as Current Directories" when I tried to change the CD to our servers directory.
What I would like it to do is display in a dialog box the modified date of a "Text.txt" located on our server \\Server\Folder
Any and all help is appreciated
Next .bat script should work:
set "_folder=\\Server\Folder"
set "_filename=Text.txt"
set "_filedatetime=N/A"
pushd %_folder%
for %%G in (%_filename%) do (
rem echo %%~tG %%~fG
if not "%%~tG"=="" set "_filedatetime=%%~tG"
)
popd
echo file %_folder%\%_filename% date and time: %_filedatetime%
Note there is no dialog box in pure cmd command line interpreter, try set /P.
Resources:
SET: Display, set, or remove CMD environment variables
PUSHD, POPD: and UNC Network paths
FOR commands
~ Parameter Extensions
I'm creating a recycle-bin script in SH shell linux in three differant scripts, delete, trash and restore.
The first two scripts are working fine; 'Delete' moves the selected file to the recycle-bin while logging a text file called 'trashinfo' which shows the original path location of the file (to be later used in restore) and 'Trash' which removes everything in the recycle-bin.
The 'restore' script should take the logged path name gained in the delete script and return the file to its original location. I've spent more time than I'd like to remember on this and cant get the restore script to work properly!
Below is the script I've written, as far as I can make out I'm grepping for the filename variable in the text file that holds the pathname, eg 'restore testfile', this is then combined with the basename command, the testfile is then moved into the location thats been grepped and combined with the basename.
Anyone have any pointers on where I'm going wrong?
if [ "$*" != -f ]
then
path=grep "$*" /usr/local/bin/trashinfo
pathname=basename "$path"
mv "$path" "$pathname"
path=$(grep "$*" /usr/local/bin/trashinfo)
pathname=$(basename "$path")