Rename a directory during installation with the REN command - setup-project

I decided that the easiest way to rename the directory is through the REN command in windows with Exec. However, it just doesn't work. The program runs successfully, but doesn't do anything. Below is a basically what I'm trying to do.
OutFile "test.exe"
Section
Exec 'REN "C:\Rename me" "Done"'
SectionEnd
and by the way
REN "C:\Rename me" "Done"
works fine in cmd. I also tried RENAME with the same results.
Any idea what I'm doing wrong?

Ren is a internal command inside cmd.exe, you would have to execute cmd.exe /c ren foo bar but NSIS has a Rename instruction, why not use that?

Related

Command works in powershell but not via system()/system2()/shell()?

I'm looking to run a powershell command from R. it works in powershell, but I can't get it working in R.
This works in powershell
[guid]::NewGuid()
But none of these work from R
system("[guid]::NewGuid()", intern=TRUE)
system2("[guid]::NewGuid()")
shell("[guid]::NewGuid()")
Any ideas?
I think you need to tell system() that you want to use powershell and not cmd as executable.
Assuming powershell is in you PATH variable try
system('powershell -command "[guid]::NewGuid()"', intern=TRUE)
You can also try leaving intern=TRUE away depending what kind of output you expect.

Use cmd commands in QT

Hi i was checking and anyone can use commands very similar in cmd like dir mkdir etc.
But for example when i try to use command (cd ..) i couldn't
QProcess consola;
consola.start("cmd.exe /C " + comando);
consola.waitForFinished();
consola.waitForReadyRead();
This is the question how i can use more commands in cmd for qt for example.
At least from the command line:
cmd /C "cd \"
works as did directories other than root. (Note the parenthesis around the command since it contains embedded spaces.) However, this example isn't very useful because this executes the command shell, changes the directory in that command shell, and then the command shell disappears, and your current directory is back to where you started.
I recommend looking into the QDir class, which has methods such as "current ()" and "setCurrent ()" for getting and setting the current directory. There are equivalents for mkdir and many others. Also, using QDir is much more cross-platform friendly, where using the "cmd" shell is Windows-specific.
You don't say what you're trying to accomplish, so beyond that suggestion, it's impossible to know how to best help you.
Your process's current directory can be and mostly is different than current directory of your is running. Please read chdir manpage for that.
That command is mostly working but changing the current directory of your process.

Unable to execute simple cd command in Python (in Jupyter shell)

When I attempt to use the following command in Jupyter shell for Python "cd /Users/Donald/Documents/BUS6303/week 7/ocelma-python-recsys-48df9c4/ocelma-python-recsys-48df9c4/recsys/algorithm" I get a Invalid Syntax" error. What am I doing wrong?
I encountered this issue when I added a comment in the same cell. Create a new cell, without a comment, and try it again.
Did you verify that the folder actually exists?
If so, if could be the space in "week 7".
You could try this:
cd "/Users/Donald/Documents/BUS6303/week 7/ocelma-python-recsys-48df9c4/ocelma-python-recsys-48df9c4/recsys/algorithm"

'RM' is not recognized as an internal or external command while using Meteor on Windows

i am currently having problem with 'meteor' and i am currently new to this learning this stuff. So, after installing 'Meteor' i opened command prompt on Windows and typed :
meteor create goodboy
and then,
cd goodboy
But to delete the live and already running example app, i used :
rm goodboy.*
But the command prompt, gave this error :
rm is not recognized as an internal or external command, operable
program or batch file.
Is there anyway i can fix this error, thank you.
Use del on Windows.
Also, this has nothing to do with Meteor. You can also delete a Meteor project by going to the folder and dragging it to the trash.
If you are on windows, git bash may run such commands.
If you are using Mac then we can simply use
rm -f src/*
and For windows we can use command for this is
del -f "src/*"
Hope this works fine for you.
Download and Extract PortableGit.
This has most of commonly used Linux based tools ported to windows.
Add [PortableGit Path]\usr\bin to PATH variable of Windows
You can also use your system's Git installation instead of PortableGit.
This should solve the problem
I'm running Git shell prompt and for some reason it doesn't have it any more. I ended up using Cygin to get it working:
https://www.cygwin.com/
My penny's worth.
You could potentially add rm to powershell. In your (or a) profile.ps1 (or other if your powershell is not core).
rm {
del
}
or as an alias
Set-Alias rm del
or (and this is a tricky one), run WSL, bind the target folder and run via the linux interface.
PS: running the command via the Git Bash (MINGW64) terminal as suggested above, did the trick for me.
I guess you are not using bash terminal. Try this..
1- Go to the folder that you want to remove its contents lets call it my-app folder.
2- Right click in the empty space, then choose get Bash here.
3- Paste the command rm -f A_folder/* (I'm about to remove the content inside A_folder folder which is a sub-folder inside my-app).
4- Hit enter.
That should remove all content from A_folder folder.
Hope that helps.
I guess you are not using the Git Bash terminal but the normal command prompt.
Do try the same on the Git Bash terminal and you would not face this error anymore.
first, install linux clients for windows, I use Ubunto LTS
then install node.js and run your command again.
here, you find good instructions to do it so, as well as how to install cool new Windows Terminal
you should add
"remove-build": "rmdir /s /q build",
"create-build": "mkdir build",
"clean": "npm run remove-build && npm run create-build",
in package.json

Unable to get -r parameter working

I've tried in every way imaginable to execute a shell command from command line but it simply doesn't work. What am I doing wrong?
C:\Console2\Console.exe -r runstuff.bat
C:\Console2\Console.exe -d C:\Console2 -r runstuff.bat
C:\Console2\Console.exe -r dir
Neither works. (Win7 x64)
I am playing with that now.
Did you try:
console2 -r "/K runstuff.bat"
The /K is needed to keep the command open after running the script.
The problem I'm having with the "-r" option is that I'm having to type exit twice to leave the window.
If you add the command to shell command (settings... -> Tabs -> Shell) field you will not have to type exit twice:
%comspec% /K runstuff.bat
I don't think the "%comspec%" is necessary (could use "cmd" instead), but I got it from an example somewhere on the web years ago. Console2's included help file shows using "cmd".

Resources